-
Notifications
You must be signed in to change notification settings - Fork 201
/
Dockerfile.fedora
78 lines (65 loc) · 3.07 KB
/
Dockerfile.fedora
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM quay.io/fedora/s2i-core:41
# 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.4 \
MYSQL_SHORT_VERSION=84 \
APP_DATA=/opt/app-root/src \
HOME=/var/lib/mysql
ENV SUMMARY="MySQL $MYSQL_VERSION 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." \
NAME=mysql
LABEL summary="$SUMMARY" \
description="$DESCRIPTION" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="MySQL $MYSQL_VERSION" \
io.openshift.expose-services="3306:mysql" \
io.openshift.tags="database,mysql,mysql$MYSQL_SHORT_VERSION" \
com.redhat.component="$NAME" \
name="fedora/$NAME-$MYSQL_SHORT_VERSION" \
version="$MYSQL_VERSION" \
usage="docker run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/fedora/$NAME-$MYSQL_SHORT_VERSION" \
maintainer="SoftwareCollections.org <[email protected]>"
EXPOSE 3306
# On Fedora, we fake missing python binary. In case user installs the python2
# in the container, this hack will be removed by installing /usr/bin/python from RPM.
RUN ln -s /usr/bin/python3 /usr/bin/python
# 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 INSTALL_PKGS="rsync tar gettext hostname bind-utils groff-base community-mysql-server policycoreutils" && \
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf -y clean all --enablerepo='*' && \
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.4/root-common /
COPY 8.4/s2i-common/bin/ $STI_SCRIPTS_PATH
COPY 8.4/root /
# Hard links are not supported in Testing Farm approach during sync to guest
# operation system. Therefore tests are failing on error
# /usr/libexec/s2i/run no such file or directory
RUN ln -s /bin/run-mysqld $STI_SCRIPTS_PATH/run
# 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 && \
/usr/libexec/mysqld -V | grep -qe "$MYSQL_VERSION\." && echo "Found VERSION $MYSQL_VERSION"
USER 27
ENTRYPOINT ["container-entrypoint"]
CMD ["run-mysqld"]