71 lines
2.6 KiB
Docker
71 lines
2.6 KiB
Docker
FROM rhel8/s2i-core
|
|
|
|
# MySQL image for OpenShift.
|
|
#
|
|
# Volumes:
|
|
# * /var/lib/mysql/data - Datastore for MySQL
|
|
# Environment:
|
|
# * $MYSQL_USER - Database user name
|
|
# * $MYSQL_PASSWORD - User's password
|
|
# * $MYSQL_DATABASE - Name of the database to create
|
|
# * $MYSQL_ROOT_PASSWORD (Optional) - Password for the 'root' MySQL account
|
|
|
|
ENV MYSQL_VERSION=8.0 \
|
|
APP_DATA=/opt/app-root/src \
|
|
HOME=/var/lib/mysql
|
|
|
|
ENV SUMMARY="MySQL 8.0 SQL database server" \
|
|
DESCRIPTION="MySQL is a multi-user, multi-threaded SQL database server. The container \
|
|
image provides a containerized packaging of the MySQL mysqld daemon and client application. \
|
|
The mysqld server daemon accepts connections from clients and provides access to content from \
|
|
MySQL databases on behalf of the clients."
|
|
|
|
LABEL summary="$SUMMARY" \
|
|
description="$DESCRIPTION" \
|
|
io.k8s.description="$DESCRIPTION" \
|
|
io.k8s.display-name="MySQL 8.0" \
|
|
io.openshift.expose-services="3306:mysql" \
|
|
io.openshift.tags="database,mysql,mysql80,mysql-80" \
|
|
com.redhat.component="mysql-80-container" \
|
|
name="rhel8/mysql-80" \
|
|
version="1" \
|
|
usage="docker run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel8/mysql-80" \
|
|
maintainer="SoftwareCollections.org <sclorg@redhat.com>"
|
|
|
|
EXPOSE 3306
|
|
|
|
# This image must forever use UID 27 for mysql user so our volumes are
|
|
# safe in the future. This should *never* change, the last test is there
|
|
# to make sure of that.
|
|
RUN yum -y module enable mysql:$MYSQL_VERSION && \
|
|
INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind-utils groff-base mysql-server" && \
|
|
yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS shadow-utils && \
|
|
rpm -V $INSTALL_PKGS && \
|
|
yum clean all && \
|
|
mkdir -p /var/lib/mysql/data && chown -R mysql.0 /var/lib/mysql && \
|
|
test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)"
|
|
|
|
# Get prefix path and path to scripts rather than hard-code them in scripts
|
|
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \
|
|
MYSQL_PREFIX=/usr
|
|
|
|
COPY 8.0/root-common /
|
|
COPY 8.0/s2i-common/bin/ $STI_SCRIPTS_PATH
|
|
COPY 8.0/root /
|
|
|
|
# this is needed due to issues with squash
|
|
# when this directory gets rm'd by the container-setup
|
|
# script.
|
|
# Also reset permissions of filesystem to default values
|
|
RUN rm -rf /etc/my.cnf.d/* && \
|
|
/usr/libexec/container-setup && \
|
|
rpm-file-permissions
|
|
|
|
# Not using VOLUME statement since it's not working in OpenShift Online:
|
|
# https://github.com/sclorg/httpd-container/issues/30
|
|
# VOLUME ["/var/lib/mysql/data"]
|
|
|
|
USER 27
|
|
|
|
ENTRYPOINT ["container-entrypoint"]
|
|
CMD ["run-mysqld"]
|