Skip to content

Instantly share code, notes, and snippets.

@ZCube
Created December 18, 2022 10:05
Show Gist options
  • Save ZCube/63dd7e12833dd46db454b996d62c7ba6 to your computer and use it in GitHub Desktop.
Save ZCube/63dd7e12833dd46db454b996d62c7ba6 to your computer and use it in GitHub Desktop.
mysql
FROM golang:1.19-bullseye AS golang-builder
RUN mkdir -p /opt/bitnami
ADD packages.sh /packages.sh
RUN chmod +x /packages.sh && \
/packages.sh
FROM docker.io/mysql:8.0.31-oracle
ARG TARGETARCH
LABEL org.opencontainers.image.authors="https://github.com/ZCube/bitnami-compat" \
org.opencontainers.image.description="Application repackaged by ZCube for arm64 compatible, originaly Bitnami" \
org.opencontainers.image.ref.name="8.0.31-debian-11-r44" \
org.opencontainers.image.source="https://github.com/ZCube/bitnami-compat" \
org.opencontainers.image.title="mysql" \
org.opencontainers.image.vendor="ZCube" \
org.opencontainers.image.version="8.0.31"
ENV HOME="/" \
OS_ARCH="${TARGETARCH:-amd64}" \
OS_FLAVOUR="debian-11" \
OS_NAME="linux"
COPY prebuildfs /
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Install required system packages and dependencies
RUN install_packages acl ca-certificates curl gzip procps psmisc tar
RUN echo install global
COPY --from=golang-builder /opt/bitnami/ /opt/bitnami/
RUN mkdir -p /opt/bitnami/mysql/bin \
&& mkdir -p /opt/bitnami/mysql/sbin \
&& mkdir -p /opt/bitnami/mysql/lib \
&& mkdir -p /opt/bitnami/mysql/conf \
&& mkdir -p /opt/bitnami/mysql/share \
&& ln -sf /usr/bin/my* /opt/bitnami/mysql/bin/ \
&& ln -sf /usr/sbin/my* /opt/bitnami/mysql/sbin/ \
&& ln -sf /usr/sbin/my* /opt/bitnami/mysql/bin/ \
&& cp -rf /usr/lib64/mysql/plugin/ /opt/bitnami/mysql/lib/plugin/ \
&& cp -rf /usr/share/mysql-8.0/ /opt/bitnami/mysql/share/mysql-8.0/ \
&& rm -rf /var/lib/dpkg/alternatives/my.cnf \
&& rm -rf /etc/mysql/my.cnf \
&& rm -rf /etc/mysql/mysql.cnf \
&& chown 1001:1001 -R /opt/bitnami/mysql /var/run/mysqld \
&& touch /opt/bitnami/mysql/conf/my.cnf \
&& ln -sf /opt/bitnami/mysql/conf/my.cnf /etc/mysql/my.cnf \
&& rm -f /opt/bitnami/mysql/conf/my.cnf
#RUN apt-get autoremove --purge -y curl && \
#apt-get update apt-get update && apt-get upgrade -yapt-get update && apt-get upgrade -y apt-get upgrade -y && \
# apt-get clean && rm -rf /var/lib/apt/lists /var/cache/apt/archives
RUN chmod g+rwX /opt/bitnami
RUN mkdir -p /docker-entrypoint-initdb.d
COPY rootfs /
RUN /opt/bitnami/scripts/mysql/postunpack.sh
ENV APP_VERSION="8.0.31" \
BITNAMI_APP_NAME="mysql" \
PATH="/opt/bitnami/common/bin:/opt/bitnami/mysql/bin:/opt/bitnami/mysql/sbin:$PATH"
EXPOSE 3306
USER 1001
ENTRYPOINT [ "/opt/bitnami/scripts/mysql/entrypoint.sh" ]
CMD [ "/opt/bitnami/scripts/mysql/run.sh" ]
#!/bin/bash
set -e
export PACKAGE=gosu
export TARGET_DIR=common
export VERSION=1.14.0
export REF=1.14
export CGO_ENABLED=0
rm -rf ${PACKAGE} || true
mkdir -p ${PACKAGE}
git clone -b "${REF}" https://github.com/tianon/gosu ${PACKAGE}
pushd ${PACKAGE}
go mod download
go build -v -ldflags '-d -s -w' .
mkdir -p /opt/bitnami/${TARGET_DIR}/licenses
mkdir -p /opt/bitnami/${TARGET_DIR}/bin
cp -f LICENSE /opt/bitnami/${TARGET_DIR}/licenses/${PACKAGE}-${VERSION}.txt
cp -f ${PACKAGE} /opt/bitnami/${TARGET_DIR}/bin/gosu
popd
rm -rf ${PACKAGE}
#!/bin/bash
set -e
export PACKAGE=ini-file
export TARGET_DIR=common
export VERSION=1.4.4
export REF=v${VERSION}
export CGO_ENABLED=0
rm -rf ${PACKAGE} || true
mkdir -p ${PACKAGE}
git clone -b "${REF}" https://github.com/bitnami/ini-file ${PACKAGE}
pushd ${PACKAGE}
go mod download
go build -v -ldflags '-d -s -w' .
mkdir -p /opt/bitnami/${TARGET_DIR}/licenses
mkdir -p /opt/bitnami/${TARGET_DIR}/bin
cp -f COPYING /opt/bitnami/${TARGET_DIR}/licenses/${PACKAGE}-${VERSION}.txt
cp -f ${PACKAGE} /opt/bitnami/${TARGET_DIR}/bin/${PACKAGE}
popd
rm -rf ${PACKAGE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment