Skip to content

Commit

Permalink
Switch from "pwgen" to "openssl rand" and add missing Oracle deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Feb 22, 2022
1 parent 131ffdd commit 24e6931
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 29 deletions.
12 changes: 6 additions & 6 deletions 5.7/Dockerfile.debian

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions 5.7/Dockerfile.oracle

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 5.7/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions 8.0/Dockerfile.debian

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions 8.0/Dockerfile.oracle

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion 8.0/docker-entrypoint.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions template/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ RUN set -eux; \

RUN mkdir /docker-entrypoint-initdb.d

RUN apt-get update && apt-get install -y --no-install-recommends \
# for MYSQL_RANDOM_ROOT_PASSWORD
pwgen \
# for mysql_ssl_rsa_setup
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
openssl \
# FATAL ERROR: please install the following Perl modules before executing /usr/local/mysql/scripts/mysql_install_db:
# File::Basename
Expand All @@ -43,9 +42,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
perl \
# install "xz-utils" for .sql.xz docker-entrypoint-initdb.d files
xz-utils \
&& rm -rf /var/lib/apt/lists/*
; \
rm -rf /var/lib/apt/lists/*

RUN set -ex; \
RUN set -eux; \
# gpg: key 3A79BD29: public key "MySQL Release Engineering <[email protected]>" imported
key='859BE8D7C586F538430B19C2467B942D3A79BD29'; \
export GNUPGHOME="$(mktemp -d)"; \
Expand Down
16 changes: 11 additions & 5 deletions template/Dockerfile.oracle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ RUN set -eux; \
gosu --version; \
gosu nobody true

RUN set -eux; \
{{ dnf }} install -y \
gzip \
xz \
{{ if .oracle.variant | startswith("7") then "" else ( -}}
# Oracle Linux 8+ is very slim :)
findutils \
{{ ) end -}}
; \
{{ dnf }} clean all

RUN set -eux; \
# https://dev.mysql.com/doc/refman/8.0/en/checking-gpg-signature.html
# gpg: key 3A79BD29: public key "MySQL Release Engineering <[email protected]>" imported
Expand All @@ -42,11 +53,6 @@ RUN set -eux; \
gpg --batch --export --armor "$key" > /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql; \
rm -rf "$GNUPGHOME"

{{ if .oracle.variant | startswith("7") then "" else ( -}}
# Oracle Linux 8+ is very slim :)
RUN set -eux; {{ dnf }} install -y findutils; {{ dnf }} clean all

{{ ) end -}}
ENV MYSQL_MAJOR {{ env.version }}
ENV MYSQL_VERSION {{ .oracle.version }}

Expand Down
2 changes: 1 addition & 1 deletion template/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ docker_setup_db() {
fi
# Generate random root password
if [ -n "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then
export MYSQL_ROOT_PASSWORD="$(pwgen -1 32)"
MYSQL_ROOT_PASSWORD="$(openssl rand -base64 24)"; export MYSQL_ROOT_PASSWORD
mysql_note "GENERATED ROOT PASSWORD: $MYSQL_ROOT_PASSWORD"
fi
# Sets root password and creates root users for non-localhost hosts
Expand Down

0 comments on commit 24e6931

Please sign in to comment.