@@ -10,29 +10,7 @@ FROM {{ spec.s2i_base }}
1010# * $MYSQL_DATABASE - Name of the database to create
1111# * $MYSQL_ROOT_PASSWORD (Optional) - Password for the 'root' MySQL account
1212
13- {% if spec.prod == 'rhel8' and spec.version == '8.0' %}ENV MYSQL_VERSION={{ spec.version }} \
14- APP_DATA=/opt/app-root/src \
15- HOME=/var/lib/mysql
16-
17- ENV SUMMARY="MySQL {{ spec.version }} SQL database server" \
18- DESCRIPTION="MySQL is a multi-user, multi-threaded SQL database server. The container \
19- image provides a containerized packaging of the MySQL mysqld daemon and client application. \
20- The mysqld server daemon accepts connections from clients and provides access to content from \
21- MySQL databases on behalf of the clients."
22-
23- LABEL summary="$SUMMARY" \
24- description="$DESCRIPTION" \
25- io.k8s.description="$DESCRIPTION" \
26- io.k8s.display-name="MySQL {{ spec.version }}" \
27- io.openshift.expose-services="3306:mysql" \
28- io.openshift.tags="database,mysql,mysql{{ spec.short }},mysql-{{ spec.short }}" \
29- com.redhat.component="mysql-{{ spec.short }}-container" \
30- name="{{ spec.img_name }}" \
31- version="1" \
32- {% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \
33- {% endif %} usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 {{ spec.img_name }}" \
34- maintainer="SoftwareCollections.org <sclorg@redhat.com>"
35- {% else %}# Standalone ENV call so these values can be re-used in the other ENV calls
13+ # Standalone ENV call so these values can be re-used in the other ENV calls
3614ENV MYSQL_VERSION={{ spec.version }} \
3715 MYSQL_SHORT_VERSION={{ spec.short }}
3816
@@ -53,21 +31,16 @@ LABEL summary="${SUMMARY}" \
5331 io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION}{% if spec.prod == 'fedora' and spec.version == '8.0' %},rh-${NAME}${MYSQL_SHORT_VERSION}{% elif spec.prod != 'fedora' %},${NAME}-${MYSQL_SHORT_VERSION}{% endif %}" \
5432 com.redhat.component="{% if spec.prod == 'rhel8' or spec.prod == 'rhel9' or spec.prod == 'rhel10' or spec.prod == 'c9s' or spec.prod == 'c10s' %}${NAME}-${MYSQL_SHORT_VERSION}-container{% else %}${NAME}{% endif %}" \
5533 name="{{ spec.img_name }}" \
56- {% if spec.prod == 'fedora' %} version="${MYSQL_VERSION}" \
57- {% elif spec.prod != 'rhel10' %} version="1" \
58- {% endif %}{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \
34+ version="${MYSQL_VERSION}" \
35+ {% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \
5936{% endif %} usage="{% if spec.prod == 'c9s' or spec.prod == 'c10s' %}podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/{{ spec.img_name }}:{{ spec.prod }}{% elif spec.prod == 'fedora' %}docker run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/{{ spec.img_name }}{% else %}podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 {{ spec.img_name }}{% endif %}" \
6037 maintainer="SoftwareCollections.org <sclorg@redhat.com>"
61- {% endif %}
6238
6339EXPOSE 3306
6440
65- {% if spec.prod == 'fedora' %} # This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change.
41+ # This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change.
6642# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed
67- {% else %}# This image must forever use UID 27 for mysql user so our volumes are
68- # safe in the future. This should *never* change, the last test is there
69- # to make sure of that.
70- {% endif %}{% if spec.prod == 'fedora' %}RUN /usr/sbin/groupadd -g 27 -o -r mysql && \
43+ {% if spec.prod == 'fedora' %}RUN /usr/sbin/groupadd -g 27 -o -r mysql && \
7144 /usr/sbin/useradd -M -N -g mysql -o -r -d ${HOME} -s /sbin/nologin -c "MySQL Server" -u 27 mysql && \
7245 test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" && \
7346 INSTALL_PKGS="{{ spec.pkgs }}" && \
@@ -112,34 +85,23 @@ EXPOSE 3306
11285ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \
11386 MYSQL_PREFIX=/usr
11487
115- {% if spec.prod == 'rhel8' and spec.version == '8.0' %}COPY {{ spec.version }}/root-common /
116- COPY {{ spec.version }}/s2i-common/bin/ $STI_SCRIPTS_PATH
117- COPY {{ spec.version }}/root /
118- {% else %}COPY ${MYSQL_VERSION}/root-common /
88+ COPY ${MYSQL_VERSION}/root-common /
11989COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH}
12090COPY ${MYSQL_VERSION}/root /
121- {% endif %}
12291
12392# Hard links are not supported in Testing Farm approach during sync to guest
12493# operation system. Therefore tests are failing on error
12594# /usr/libexec/s2i/run no such file or directory
126- {% if spec.prod == 'rhel8' and spec.version == '8.0' %}RUN ln -s /bin/run-mysqld $STI_SCRIPTS_PATH/run
127- {% else %}RUN ln -s /bin/run-mysqld ${STI_SCRIPTS_PATH}/run
128- {% endif %}
95+ RUN ln -s /bin/run-mysqld ${STI_SCRIPTS_PATH}/run
12996
13097# this is needed due to issues with squash
13198# when this directory gets rm'd by the container-setup
13299# script.
133100# Also reset permissions of filesystem to default values
134- {% if spec.prod == 'rhel8' and spec.version == '8.0' %}RUN rm -rf /etc/my.cnf.d/* && \
135- /usr/libexec/container-setup && \
136- rpm-file-permissions && \
137- /usr/libexec/mysqld -V | grep -qe "$MYSQL_VERSION\. " && echo "Found VERSION $MYSQL_VERSION"
138- {% else %}RUN rm -rf /etc/my.cnf.d/* && \
101+ RUN rm -rf /etc/my.cnf.d/* && \
139102 /usr/libexec/container-setup && \
140103 rpm-file-permissions && \
141104 /usr/libexec/mysqld -V | grep -qe "${MYSQL_VERSION}\. " && echo "Found VERSION ${MYSQL_VERSION}"
142- {% endif %}
143105
144106USER 27
145107
0 commit comments