106 lines
4.6 KiB
Docker
106 lines
4.6 KiB
Docker
# This is temporary placeholder for UBI8-based Docker image for PS-8.0
|
|
FROM redhat/ubi8-minimal
|
|
|
|
LABEL org.opencontainers.image.authors="info@percona.com"
|
|
|
|
RUN set -ex; \
|
|
# shadow-utils are needed for user/group manipulation on UBI-based images
|
|
microdnf -y update; \
|
|
microdnf -y install glibc-langpack-en \
|
|
nss_wrapper \
|
|
shadow-utils; \
|
|
microdnf clean all; \
|
|
groupadd -g 1001 mysql; \
|
|
useradd -u 1001 -r -g 1001 -s /sbin/nologin \
|
|
-m -c "Default Application User" mysql
|
|
|
|
# Do not report during Docker image creation.
|
|
ARG PERCONA_TELEMETRY_DISABLE=1
|
|
|
|
# check repository package signature in secure way
|
|
RUN set -ex; \
|
|
export GNUPGHOME="$(mktemp -d)"; \
|
|
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 4D1BB29D63D98E422B2113B19334A25F8507EFA5 99DB70FAE1D7CE227FB6488205B555B38483C65D; \
|
|
gpg --batch --export --armor 4D1BB29D63D98E422B2113B19334A25F8507EFA5 > ${GNUPGHOME}/PERCONA-PACKAGING-KEY; \
|
|
gpg --batch --export --armor 99DB70FAE1D7CE227FB6488205B555B38483C65D > ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \
|
|
rpmkeys --import ${GNUPGHOME}/PERCONA-PACKAGING-KEY ${GNUPGHOME}/RPM-GPG-KEY-centosofficial; \
|
|
microdnf -y install findutils; \
|
|
curl -Lf -o /tmp/percona-release.rpm https://repo.percona.com/yum/percona-release-latest.noarch.rpm; \
|
|
rpmkeys --checksig /tmp/percona-release.rpm; \
|
|
rpm -i /tmp/percona-release.rpm; \
|
|
rm -rf "$GNUPGHOME" /tmp/percona-release.rpm; \
|
|
rpm --import /etc/pki/rpm-gpg/PERCONA-PACKAGING-KEY; \
|
|
#microdnf -y module disable mysql; \
|
|
percona-release disable all; \
|
|
percona-release enable ps-80 release; \
|
|
percona-release enable mysql-shell release; \
|
|
curl -Lf -o /tmp/numactl-libs.rpm https://rpmfind.net/linux/centos/8-stream/BaseOS/x86_64/os/Packages/numactl-libs-2.0.16-3.el8.x86_64.rpm; \
|
|
rpmkeys --checksig /tmp/numactl-libs.rpm; \
|
|
rpm -i /tmp/numactl-libs.rpm; \
|
|
rm -rf /tmp/numactl-libs.rpm
|
|
|
|
ENV PS_VERSION 8.0.35-27.1
|
|
ENV MYSQL_SHELL_VERSION 8.0.35-1
|
|
ENV OS_VER el8
|
|
ENV FULL_PERCONA_VERSION "$PS_VERSION.$OS_VER"
|
|
ENV FULL_MYSQL_SHELL_VERSION "$MYSQL_SHELL_VERSION.$OS_VER"
|
|
ENV CALL_HOME_DOWNLOAD_SHA256 5e84d2f1a5d57f44c46e6a1f16794d649d3de09fe8021f0294bc321c89e51068
|
|
ENV CALL_HOME_VERSION 0.1
|
|
|
|
RUN set -ex; \
|
|
rpm -e --nodeps tzdata; \
|
|
microdnf -y install \
|
|
tzdata \
|
|
jemalloc \
|
|
which \
|
|
cracklib-dicts \
|
|
policycoreutils; \
|
|
\
|
|
microdnf -y install \
|
|
percona-server-server-${FULL_PERCONA_VERSION} \
|
|
#percona-server-tokudb-${FULL_PERCONA_VERSION} \
|
|
percona-server-devel-${FULL_PERCONA_VERSION} \
|
|
percona-server-rocksdb-${FULL_PERCONA_VERSION} \
|
|
percona-icu-data-files-${FULL_PERCONA_VERSION} \
|
|
percona-mysql-shell-${FULL_MYSQL_SHELL_VERSION}; \
|
|
microdnf clean all; \
|
|
rm -rf /var/cache/dnf /var/cache/yum /var/lib/mysql
|
|
|
|
# purge and re-create /var/lib/mysql with appropriate ownership
|
|
RUN set -ex; \
|
|
/usr/bin/install -m 0775 -o mysql -g root -d /var/lib/mysql /var/run/mysqld /docker-entrypoint-initdb.d; \
|
|
# comment out a few problematic configuration values
|
|
find /etc/my.cnf /etc/my.cnf.d -name '*.cnf' -print0 \
|
|
| xargs -0 grep -lZE '^(bind-address|log|user)' \
|
|
| xargs -rt -0 sed -Ei 's/^(bind-address|log|user)/#&/'; \
|
|
# don't reverse lookup hostnames, they are usually another container
|
|
echo '!includedir /etc/my.cnf.d' >> /etc/my.cnf; \
|
|
printf '[mysqld]\nskip-host-cache\nskip-name-resolve\n' > /etc/my.cnf.d/docker.cnf; \
|
|
# TokuDB modifications
|
|
/usr/bin/install -m 0664 -o mysql -g root /dev/null /etc/sysconfig/mysql; \
|
|
echo "LD_PRELOAD=/usr/lib64/libjemalloc.so.1" >> /etc/sysconfig/mysql; \
|
|
echo "THP_SETTING=never" >> /etc/sysconfig/mysql; \
|
|
# allow to change config files
|
|
chown -R mysql:root /etc/my.cnf /etc/my.cnf.d; \
|
|
chmod -R ug+rwX /etc/my.cnf /etc/my.cnf.d
|
|
|
|
VOLUME ["/var/lib/mysql", "/var/log/mysql"]
|
|
|
|
RUN set -eux; \
|
|
curl -fL "https://github.com/Percona-Lab/telemetry-agent/archive/refs/tags/phase-$CALL_HOME_VERSION.tar.gz" -o "phase-$CALL_HOME_VERSION.tar.gz"; \
|
|
echo "$CALL_HOME_DOWNLOAD_SHA256 phase-$CALL_HOME_VERSION.tar.gz" | sha256sum --strict --check; \
|
|
tar -xvf phase-$CALL_HOME_VERSION.tar.gz; \
|
|
cp telemetry-agent-phase-$CALL_HOME_VERSION/call-home.sh .;\
|
|
rm -rf telemetry-agent-phase-$CALL_HOME_VERSION phase-$CALL_HOME_VERSION.tar.gz; \
|
|
chmod a+rx /call-home.sh; \
|
|
mkdir -p /usr/local/percona; \
|
|
chown mysql:mysql /usr/local/percona
|
|
ENV CALL_HOME_OPTIONAL_PARAMS=" -s ${OS_VER}-openshift"
|
|
|
|
COPY ps-entry.sh /docker-entrypoint.sh
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
|
|
|
USER mysql
|
|
EXPOSE 3306 33060
|
|
CMD ["mysqld"]
|