2020-11-26 18:32:20 -07:00
|
|
|
#
|
2022-02-19 08:26:29 -07:00
|
|
|
# mariadb running on Alpine Linux
|
2020-11-26 18:32:20 -07:00
|
|
|
#
|
|
|
|
|
2022-02-19 08:26:29 -07:00
|
|
|
# build arguments
|
2024-09-07 20:01:55 -06:00
|
|
|
ARG ALPINE_VERSION="3.20"
|
|
|
|
ARG MARIADB_VERSION="10.11.8-r0"
|
2022-02-19 08:26:29 -07:00
|
|
|
|
|
|
|
FROM alpine:${ALPINE_VERSION}
|
|
|
|
ARG ALPINE_VERSION
|
|
|
|
ARG MARIADB_VERSION
|
2020-11-26 18:32:20 -07:00
|
|
|
|
|
|
|
# standardized labels
|
2021-09-07 01:33:11 -06:00
|
|
|
MAINTAINER Asif Bacchus <asif@asifbacchus.dev>
|
|
|
|
LABEL dev.asifbacchus.docker.internalName="ab-mariadb-alpine"
|
|
|
|
LABEL org.opencontainer.image.authors="Asif Bacchus <asif@asifbacchus.dev>"
|
2022-02-19 08:26:29 -07:00
|
|
|
LABEL org.opencontainer.image.description="Mariadb on Alpine Linux."
|
2021-09-07 01:33:11 -06:00
|
|
|
LABEL org.opencontainer.image.documentation="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine/raw/branch/main/README.md"
|
|
|
|
LABEL org.opencontainer.image.source="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine.git"
|
|
|
|
LABEL org.opencontainer.image.title="ab-mariadb-alpine"
|
|
|
|
LABEL org.opencontainer.image.url="https://git.asifbacchus.dev/ab-docker/ab-mariadb-alpine"
|
|
|
|
LABEL org.opencontainer.image.vendor="Asif Bacchus <asif@asifbacchus.dev>"
|
2020-11-26 18:32:20 -07:00
|
|
|
|
2020-11-28 02:48:27 -07:00
|
|
|
# install mariadb and turn on TCP connection in default config
|
2022-02-19 08:26:29 -07:00
|
|
|
RUN apk --update --no-cache add \
|
2021-09-07 04:14:49 -06:00
|
|
|
tzdata \
|
2022-02-19 08:26:29 -07:00
|
|
|
mariadb>${MARIADB_VERSION} \
|
|
|
|
mariadb-client>${MARIADB_VERSION} \
|
|
|
|
mariadb-server-utils>${MARIADB_VERSION} \
|
|
|
|
&& apk --no-cache --update upgrade \
|
2020-11-28 03:47:39 -07:00
|
|
|
&& sed -i 's/skip-networking/skip-networking=0/' /etc/my.cnf.d/mariadb-server.cnf
|
2020-11-26 18:32:20 -07:00
|
|
|
|
|
|
|
# expose ports
|
|
|
|
EXPOSE 3306
|
|
|
|
|
|
|
|
# create volume if user forgets
|
|
|
|
VOLUME ["/var/lib/mysql"]
|
|
|
|
|
2021-09-07 03:06:20 -06:00
|
|
|
# basic healthcheck (service only)
|
|
|
|
HEALTHCHECK \
|
|
|
|
--interval=30s \
|
|
|
|
--timeout=10s \
|
2024-01-27 17:31:15 -07:00
|
|
|
--start-period=5s \
|
2021-09-07 03:06:20 -06:00
|
|
|
--retries=3 \
|
|
|
|
CMD mysqladmin ping --silent
|
|
|
|
|
2020-11-26 18:32:20 -07:00
|
|
|
# set environment variables
|
|
|
|
ENV TZ=Etc/UTC
|
2020-11-27 01:40:14 -07:00
|
|
|
ENV MYSQL_UID=8100
|
|
|
|
ENV MYSQL_GID=8100
|
2020-11-28 03:45:43 -07:00
|
|
|
ENV MYSQL_SKIP_NAME_RESOLVE=TRUE
|
2020-11-26 18:32:20 -07:00
|
|
|
ENV MYSQL_ROOT_PASSWORD=''
|
|
|
|
ENV MYSQL_DATABASE='myData'
|
2020-11-27 01:40:14 -07:00
|
|
|
ENV MYSQL_CHARSET='utf8mb4'
|
|
|
|
ENV MYSQL_COLLATION='utf8mb4_general_ci'
|
2020-11-26 18:32:20 -07:00
|
|
|
ENV MYSQL_USER=''
|
|
|
|
ENV MYSQL_PASSWORD=''
|
|
|
|
|
2020-11-27 02:28:25 -07:00
|
|
|
# copy scripts and make script/sql directories
|
2020-11-27 01:51:27 -07:00
|
|
|
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
2020-11-27 02:28:25 -07:00
|
|
|
RUN mkdir -p /docker-entrypoint-preinit.d \
|
|
|
|
&& mkdir -p /docker-entrypoint-initdb.d \
|
2022-02-19 08:26:29 -07:00
|
|
|
&& mkdir -p /docker-entrypoint-postinit.d \
|
|
|
|
&& chmod +x /usr/local/bin/entrypoint.sh
|
2020-11-27 01:51:27 -07:00
|
|
|
|
2020-11-26 18:32:20 -07:00
|
|
|
# set entrypoint and default command
|
|
|
|
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ]
|
2020-11-28 04:23:47 -07:00
|
|
|
CMD [ "/usr/bin/mysqld", "--user=mysql", "--console" ]
|
2020-11-26 18:32:20 -07:00
|
|
|
|
2021-05-12 21:33:59 -06:00
|
|
|
# add parameters, version and build date labels
|
2021-09-07 01:33:11 -06:00
|
|
|
# set build timestamp and version labels
|
|
|
|
ARG INTERNAL_VERSION
|
|
|
|
ARG GIT_COMMIT
|
2020-11-26 18:32:20 -07:00
|
|
|
ARG BUILD_DATE
|
2021-09-07 01:33:11 -06:00
|
|
|
LABEL dev.asifbacchus.docker.internalVersion=${INTERNAL_VERSION}
|
|
|
|
LABEL org.opencontainers.image.version="${INTERNAL_VERSION}-${MARIADB_VERSION}"
|
|
|
|
LABEL org.opencontainers.image.revision=${GIT_COMMIT}
|
|
|
|
LABEL org.opencontainers.image.created=${BUILD_DATE}
|
|
|
|
|
2023-11-01 17:01:18 -06:00
|
|
|
#EOF
|