Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions docker/mysql/8/debian12/8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM marketplace.gcr.io/google/debian12
FROM marketplace.gcr.io/google/debian12@sha256:f13f9826c524466f844e74534b8add32f51acd2be428b5dee782fe9086e59861

# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
RUN groupadd -r mysql && useradd -r -g mysql mysql
Expand Down Expand Up @@ -65,21 +65,7 @@ RUN echo "deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/ap

# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
# also, we set debconf keys to make APT a little quieter
RUN { \
echo mysql-community-server mysql-community-server/data-dir select ''; \
echo mysql-community-server mysql-community-server/root-pass password ''; \
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
echo mysql-community-server mysql-community-server/remove-test-db select false; \
} | debconf-set-selections \
&& apt-get --allow-releaseinfo-change update \
&& apt-get install -y \
mysql-community-client="${MYSQL_VERSION}" \
mysql-community-server-core="${MYSQL_VERSION}" \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
&& chmod 1777 /var/run/mysqld /var/lib/mysql


VOLUME /var/lib/mysql
# Config files
Expand Down
5 changes: 3 additions & 2 deletions docker/mysql/exporter/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM golang:1.21 as exporter-builder
ARG BASE_REGISTRY="docker.io"
FROM ${BASE_REGISTRY} /golang as exporter-builder

ENV GOPATH /usr/local

Expand Down Expand Up @@ -28,7 +29,7 @@ RUN set -eux \
&& mkdir -p "${GOPATH}/src/github.com/prometheus/mysqld_exporter" \
&& tar -xzf /tmp/mysqld_exporter.tar.gz --strip-components=1 -C "${GOPATH}/src/github.com/prometheus/mysqld_exporter"

FROM marketplace.gcr.io/google/debian12
FROM marketplace.gcr.io/google/debian12@sha256:f13f9826c524466f844e74534b8add32f51acd2be428b5dee782fe9086e59861

#resolve security issues
RUN apt-get update; \
Expand Down
3 changes: 2 additions & 1 deletion docker/mysql/templates/exporter/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{{- $mysqld_exporter := index .Packages "mysqld_exporter" -}}
{{- $template := index .TemplateArgs -}}

FROM golang:{{ $golang.Minor }} as exporter-builder
ARG BASE_REGISTRY="docker.io"
FROM ${BASE_REGISTRY} /golang as exporter-builder

ENV GOPATH /usr/local

Expand Down
26 changes: 1 addition & 25 deletions docker/mysql/templates/mysql/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -71,31 +71,7 @@ RUN echo "deb [ signed-by=/etc/apt/keyrings/mysql.gpg ] http://repo.mysql.com/ap

# the "/var/lib/mysql" stuff here is because the mysql-server postinst doesn't have an explicit way to disable the mysql_install_db codepath besides having a database already "configured" (ie, stuff in /var/lib/mysql/mysql)
# also, we set debconf keys to make APT a little quieter
RUN { \
echo mysql-community-server mysql-community-server/data-dir select ''; \
echo mysql-community-server mysql-community-server/root-pass password ''; \
echo mysql-community-server mysql-community-server/re-root-pass password ''; \
echo mysql-community-server mysql-community-server/remove-test-db select false; \
} | debconf-set-selections \
&& apt-get --allow-releaseinfo-change update \
&& apt-get install -y \
{{- if eq $mysql.Major "8.0" }}
mysql-community-client="${MYSQL_VERSION}" \
mysql-community-server-core="${MYSQL_VERSION}" \
{{- else }}
mysql-server="${MYSQL_VERSION}" \
# comment out a few problematic configuration values
&& find /etc/mysql/ -name '*.cnf' -print0 \
| xargs -0 grep -lZE '^(bind-address|log)' \
| xargs -rt -0 sed -Ei 's/^(bind-address|log)/#&/' \
# don't reverse lookup hostnames, they are usually another container
&& echo '[mysqld]\nskip-host-cache\nskip-name-resolve' > /etc/mysql/conf.d/docker.cnf \
{{- end }}
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/mysql && mkdir -p /var/lib/mysql /var/run/mysqld \
&& chown -R mysql:mysql /var/lib/mysql /var/run/mysqld \
# ensure that /var/run/mysqld (used for socket and lock files) is writable regardless of the UID our mysqld instance ends up having at runtime
&& chmod 1777 /var/run/mysqld /var/lib/mysql


VOLUME /var/lib/mysql

Expand Down
6 changes: 3 additions & 3 deletions docker/mysql/versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


cloudbuild:
docker_image: gcr.io/cloud-builders/docker:24.0.9
docker_image: gcr.io/cloud-builders/docker@sha256:1a9553236b25fd6e1bf2a864c8becb26782c429f4570695b27f4ad6f1a0ed75e
enable_parallel: false
versions:
- annotations:
Expand All @@ -25,7 +25,7 @@ versions:
dir: 8/debian12/8.0
excludeTests:
- tests/functional_tests/mysqld_exporter_test.yaml
from: marketplace.gcr.io/google/debian12
from: marketplace.gcr.io/google/debian12@sha256:f13f9826c524466f844e74534b8add32f51acd2be428b5dee782fe9086e59861
packages:
gosu:
gpg: B42F6819007F00F88E364FD4036A9C25BF357DD4
Expand Down Expand Up @@ -54,7 +54,7 @@ versions:
excludeTests:
- tests/functional_tests/create_db_test.yaml
- tests/functional_tests/remote_host_test.yaml
from: marketplace.gcr.io/google/debian12
from: marketplace.gcr.io/google/debian12@sha256:f13f9826c524466f844e74534b8add32f51acd2be428b5dee782fe9086e59861
packages:
golang:
minor: '1.21'
Expand Down