Skip to content

Commit

Permalink
dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
szachovy committed Oct 9, 2024
1 parent 2b717f8 commit 0ad953d
Show file tree
Hide file tree
Showing 7 changed files with 278 additions and 105 deletions.
2 changes: 2 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ignored:
- DL3002 # Using gosu in some entrypoints
105 changes: 76 additions & 29 deletions services/mysql-mgmt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
FROM ubuntu:22.04
ARG BUILDPLATFORM="amd64"
FROM --platform=${BUILDPLATFORM} ubuntu:22.04

LABEL version="1.0"

ARG MYSQL_SHELL_VERSION="mysql-shell-8.3.0-linux-glibc2.28-x86-64bit" \
MYSQL_SHELL_MD5_CHECKSUM="c71280416014b9340b34b90160f42e23" \
MYSQL_ROUTER_VERSION="mysql-router-8.3.0-linux-glibc2.28-x86_64" \
MYSQL_ROUTER_MD5_CHECKSUM="6ea1c55a258d20fc51a4c383a1e7433e"

COPY --chown=superset:superset . "/opt"

ENV LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
DEBIAN_FRONTEND="noninteractive" \
PATH="${PATH}:/opt/${MYSQL_SHELL_VERSION}/bin:/opt/${MYSQL_ROUTER_VERSION}/bin"

WORKDIR "/opt"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN \
apt \
set \
-eux \
&& \
apt-get \
update \
&& \
apt \
apt-get \
install \
--yes \
libkeyutils1 \
wget \
xz-utils \
keepalived \
mysql-client \
ifmetric \
sudo \
"gpg=2.2.27-3ubuntu2.1" \
"ifmetric=0.3-5" \
"keepalived=1:2.2.4-0.2build1" \
"libkeyutils1=1.6.1-2ubuntu3" \
"mysql-client=8.0.39-0ubuntu0.22.04.1" \
"sudo=1.9.9-1ubuntu2.4" \
"wget=1.21.2-2ubuntu1.1" \
"xz-utils=5.2.5-2ubuntu1" \
&& \
groupadd \
--system \
Expand All @@ -35,26 +56,46 @@ RUN \
mkdir \
"/opt/initcontainer" \
&& \
rm \
--recursive \
--force \
"/var/lib/apt/lists/*"

ARG MYSQL_SHELL_VERSION="mysql-shell-8.3.0-linux-glibc2.28-x86-64bit"
ARG MYSQL_ROUTER_VERSION="mysql-router-8.3.0-linux-glibc2.28-x86_64"

ENV DEBIAN_FRONTEND="noninteractive"
ENV PATH="${PATH}:/opt/${MYSQL_SHELL_VERSION}/bin:/opt/${MYSQL_ROUTER_VERSION}/bin"

WORKDIR "/opt"

RUN \
gpg \
--import \
"/opt/dev_mysql_signature.asc" \
&& \
wget \
--quiet \
"https://github.com/a8m/envsubst/releases/download/v1.2.0/envsubst-Linux-x86_64" \
"https://dev.mysql.com/get/Downloads/MySQL-Shell/${MYSQL_SHELL_VERSION}.tar.gz" \
"https://dev.mysql.com/get/Downloads/MySQL-Router/${MYSQL_ROUTER_VERSION}.tar.xz" \
&& \
echo "${MYSQL_SHELL_MD5_CHECKSUM} ${MYSQL_SHELL_VERSION}.tar.gz" \
| md5sum \
--check \
- \
&& \
echo "${MYSQL_ROUTER_MD5_CHECKSUM} ${MYSQL_ROUTER_VERSION}.tar.xz" \
| md5sum \
--check \
- \
&& \
wget \
--quiet \
--output-document \
"${MYSQL_SHELL_VERSION}.tar.gz.asc" \
"https://downloads.mysql.com/archives/gpg/?file=${MYSQL_SHELL_VERSION}.tar.gz&p=43" \
&& \
gpg \
--verify \
"${MYSQL_SHELL_VERSION}.tar.gz.asc" \
&& \
wget \
--quiet \
--output-document \
"${MYSQL_ROUTER_VERSION}.tar.xz.asc" \
"https://downloads.mysql.com/archives/gpg/?file=${MYSQL_ROUTER_VERSION}.tar.xz&p=41" \
&& \
gpg \
--verify \
"${MYSQL_ROUTER_VERSION}.tar.xz.asc" \
&& \
tar \
--extract \
--file \
Expand All @@ -70,11 +111,17 @@ RUN \
744 \
"/opt/envsubst-Linux-x86_64" \
&& \
rm \
"${MYSQL_SHELL_VERSION}.tar.gz" \
"${MYSQL_ROUTER_VERSION}.tar.xz" \
&& \
echo \
"superset ALL=(ALL) NOPASSWD: /usr/sbin/keepalived" \
>> \
"/etc/sudoers.d/keepalived"
"/etc/sudoers.d/keepalived" \
&& \
apt-get \
clean \
&& \
rm \
--recursive \
--force \
"${MYSQL_SHELL_VERSION}.tar.gz" \
"${MYSQL_ROUTER_VERSION}.tar.xz" \
"/var/lib/apt/lists/*"
49 changes: 49 additions & 0 deletions services/mysql-mgmt/dev_mysql_signature.asc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: SKS 1.1.6
Comment: Hostname: pgp.mit.edu

mQINBGU2rNoBEACSi5t0nL6/Hj3d0PwsbdnbY+SqLUIZ3uWZQm6tsNhvTnahvPPZBGdl99iW
YTt2KmXp0KeN2s9pmLKkGAbacQP1RqzMFnoHawSMf0qTUVjAvhnI4+qzMDjTNSBq9fa3nHmO
YxownnrRkpiQUM/yD7/JmVENgwWb6akZeGYrXch9jd4XV3t8OD6TGzTedTki0TDNr6YZYhC7
jUm9fK9Zs299pzOXSxRRNGd+3H9gbXizrBu4L/3lUrNf//rM7OvV9Ho7u9YYyAQ3L3+OABK9
FKHNhrpi8Q0cbhvWkD4oCKJ+YZ54XrOG0YTg/YUAs5/3//FATI1sWdtLjJ5pSb0onV3LIbar
RTN8lC4Le/5kd3lcot9J8b3EMXL5p9OGW7wBfmNVRSUI74Vmwt+v9gyp0Hd0keRCUn8lo/1V
0YD9i92KsE+/IqoYTjnya/5kX41jB8vr1ebkHFuJ404+G6ETd0owwxq64jLIcsp/GBZHGU0R
KKAo9DRLH7rpQ7PVlnw8TDNlOtWt5EJlBXFcPL+NgWbqkADAyA/XSNeWlqonvPlYfmasnAHA
pMd9NhPQhC7hJTjCiAwG8UyWpV8Dj07DHFQ5xBbkTnKH2OrJtguPqSNYtTASbsWz09S8ujoT
DXFT17NbFM2dMIiq0a4VQB3SzH13H2io9Cbg/TzJrJGmwgoXgwARAQABtDZNeVNRTCBSZW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OIeqIIId/TEqwS61csY9aav4j4KLOZFCGNU0FV
ji7NQewSpepTcJwfJDOzmtiDP4vol1ApJGLRwZZZ9PB6wsOgDOoP6sr0YrDI/NNX2RyXXbgl
nQ1yJZVSH3/3eo6knG2qTthUKHCRDNKdy9Qqc1x4WWWtSRjh+zX8AvJK2q1rVLH2/3ilxe9w
cAZUlaj3id3TxquAlud4lWDz
=h5nH
-----END PGP PUBLIC KEY BLOCK-----
83 changes: 66 additions & 17 deletions services/mysql-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
FROM mysql:8.0-debian
ARG BUILDPLATFORM="amd64"
FROM --platform=${BUILDPLATFORM} mysql:8.0-debian

COPY --chown=mysql "mysql_config.cnf.tpl" "/opt/"
LABEL version="1.0"

ENV LANG="C.UTF-8" \
LC_ALL="C.UTF-8"

COPY --chown=mysql:mysql "mysql_config.cnf.tpl" "/opt/"
COPY "store_credentials.exp" "/opt/"

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN \
apt \
set \
-eux \
&& \
apt-get \
update \
&& \
apt \
apt-get \
install \
--yes \
curl \
expect \
gosu \
"curl=7.88.1-10+deb12u7" \
"expect=5.45.4-2+b1" \
"gosu=1.14-1+b10" \
&& \
curl \
--location \
Expand All @@ -22,22 +33,60 @@ RUN \
&& \
chmod \
555 \
envsubst \
"envsubst" \
&& \
mkdir \
"/etc/mysql/ssl" \
&& \
apt-get \
clean \
&& \
rm \
--recursive \
--force \
"/var/lib/apt/lists/*"

ENTRYPOINT sh -c " \
chmod 444 /var/run/mysqld/mysql_root_password && \
chown --recursive mysql:mysql /etc/mysql/ssl /etc/mysql/conf.d /var/run/mysqld && \
gosu mysql ./envsubst -no-unset -no-empty < /opt/mysql_config.cnf.tpl > /etc/mysql/conf.d/mysql_config.cnf && \
exec gosu mysql docker-entrypoint.sh mysqld & \
sleep ${HEALTHCHECK_START_PERIOD} && \
chmod 400 /var/run/mysqld/mysql_root_password && \
chown --recursive root:root /var/run/mysqld && \
tail -f /dev/null"
ENTRYPOINT [ "/bin/bash", "-c", " \
chmod \
444 \
/var/run/mysqld/mysql_root_password \
&& \
chown \
--recursive \
mysql:mysql \
/etc/mysql/ssl \
/etc/mysql/conf.d \
/var/run/mysqld \
&& \
gosu \
mysql \
./envsubst \
-no-unset \
-no-empty \
< /opt/mysql_config.cnf.tpl \
> /etc/mysql/conf.d/mysql_config.cnf \
&& \
exec \
gosu \
mysql \
docker-entrypoint.sh \
mysqld \
& \
sleep \
${HEALTHCHECK_START_PERIOD} \
&& \
chmod \
400 \
/var/run/mysqld/mysql_root_password \
&& \
chown \
--recursive \
root:root \
/var/run/mysqld \
&& \
tail \
--follow \
/dev/null \
-- \
" \
]
Loading

0 comments on commit 0ad953d

Please sign in to comment.