050cc62
FROM fedora:26
d27be39
d27be39
LABEL MAINTAINER "Honza Horak" <hhorak@redhat.com>
d27be39
d27be39
# MariaDB image for OpenShift.
d27be39
#
d27be39
# Volumes:
d27be39
#  * /var/lib/mysql/data - Datastore for MariaDB
d27be39
# Environment:
d27be39
#  * $MYSQL_USER - Database user name
d27be39
#  * $MYSQL_PASSWORD - User's password
d27be39
#  * $MYSQL_DATABASE - Name of the database to create
d27be39
#  * $MYSQL_ROOT_PASSWORD (Optional) - Password for the 'root' MySQL account
d27be39
d27be39
ENV MYSQL_VERSION=10.1 \
d27be39
    HOME=/var/lib/mysql
d27be39
d27be39
LABEL summary="MariaDB is a multi-user, multi-threaded SQL database server" \
d27be39
      io.k8s.description="MariaDB is a multi-user, multi-threaded SQL database server" \
d27be39
      io.k8s.display-name="MariaDB 10.1" \
d27be39
      io.openshift.expose-services="3306:mysql" \
d27be39
      io.openshift.tags="database,mysql,mariadb,mariadb101,galera"
d27be39
2379216
ENV NAME=mariadb VERSION=10.1 RELEASE=32 ARCH=x86_64
d27be39
LABEL BZComponent="$NAME" \
d27be39
        Name="$FGC/$NAME" \
d27be39
        Version="$VERSION" \
d27be39
        Release="$RELEASE.$DISTTAG" \
d27be39
        Architecture="$ARCH"
d27be39
d27be39
EXPOSE 3306
d27be39
d27be39
# This image must forever use UID 27 for mysql user so our volumes are
d27be39
# safe in the future. This should *never* change, the last test is there
d27be39
# to make sure of that.
d27be39
RUN INSTALL_PKGS="rsync tar gettext hostname bind-utils mariadb-server policycoreutils" && \
d27be39
    dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
d27be39
    rpm -V $INSTALL_PKGS && \
d27be39
    dnf clean all && \
d27be39
    mkdir -p /var/lib/mysql/data && chown -R mysql.0 /var/lib/mysql && \
d27be39
    test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)"
d27be39
d27be39
# On Fedora, we fake missing python binary. In case user installs the python2
d27be39
# in the container, this hack will be removed by installing /usr/bin/python from RPM.
d27be39
RUN ln -s /usr/bin/python3 /usr/bin/python
d27be39
d27be39
# Get prefix path and path to scripts rather than hard-code them in scripts
d27be39
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \
d27be39
    MYSQL_PREFIX=/usr
d27be39
d27be39
ADD root /
d27be39
d27be39
# this is needed due to issues with squash
d27be39
# when this directory gets rm'd by the container-setup
d27be39
# script.
d27be39
RUN rm -rf /etc/my.cnf.d/*
d27be39
RUN /usr/libexec/container-setup
d27be39
d27be39
VOLUME ["/var/lib/mysql/data"]
d27be39
d27be39
USER 27
d27be39
d27be39
ENTRYPOINT ["container-entrypoint"]
d27be39
CMD ["run-mysqld"]