Skip to content

Commit 287317b

Browse files
committed
v1.0.0
1 parent dcfbe60 commit 287317b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docker/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
FROM alpine:3.11
2+
3+
LABEL maintainer="Jose Quintana <git.io/joseluisq>"
4+
5+
ARG USER_NAME
6+
ARG USER_HOME_DIR
7+
8+
ENV BUILD_DEPS="gettext" \
9+
RUNTIME_DEPS="libintl" \
10+
\
11+
USER_NAME=${USER_NAME:-mysql} \
12+
USER_HOME_DIR=${USER_HOME_DIR:-/home/${USER_NAME}}
13+
14+
RUN adduser -h ${USER_HOME_DIR} -s /sbin/nologin -u 1000 -D ${USER_NAME} && \
15+
\
16+
apk --no-cache add ca-certificates tzdata mysql-client nano dumb-init && \
17+
\
18+
set -ex; \
19+
apkArch="$(apk --print-arch)"; \
20+
case "$apkArch" in \
21+
armhf) arch='arm' ;; \
22+
aarch64) arch='arm64' ;; \
23+
x86_64) arch='amd64' ;; \
24+
*) echo >&2 "error: unsupported architecture: $apkArch"; exit 1 ;; \
25+
esac; \
26+
\
27+
apk add --update $RUNTIME_DEPS && \
28+
apk add --virtual build_deps $BUILD_DEPS && \
29+
\
30+
cp /usr/bin/envsubst /usr/local/bin/envsubst && \
31+
apk del build_deps
32+
33+
COPY ./__mysqldump.sh /usr/local/bin/__mysqldump.sh
34+
COPY ./mysql_exporter /usr/local/bin/mysql_exporter
35+
36+
RUN chmod +x /usr/local/bin/__mysqldump.sh && \
37+
chmod +x /usr/local/bin/mysql_exporter
38+
39+
USER ${USER_NAME}
40+
WORKDIR ${USER_HOME_DIR}
41+
VOLUME ${USER_HOME_DIR}
42+
EXPOSE 3306
43+
44+
ENTRYPOINT [ "/usr/bin/dumb-init" ]
45+
CMD [ "mysql" ]
46+
47+
# Metadata
48+
LABEL org.opencontainers.image.vendor="Jose Quintana" \
49+
org.opencontainers.image.url="https://github.com/joseluisq/alpine-mysql-client" \
50+
org.opencontainers.image.title="Alpine / MySQL Client" \
51+
org.opencontainers.image.description="MySQL client tools on top of Alpine Linux x86_64." \
52+
org.opencontainers.image.version="v1.0.0" \
53+
org.opencontainers.image.documentation="https://github.com/joseluisq/alpine-mysql-client/blob/master/README.md"

0 commit comments

Comments
 (0)