From 25a9aff6d615ae8b87a5a6fd148d52085bc4e8cd Mon Sep 17 00:00:00 2001 From: Nikola Davidova Date: Thu, 28 May 2026 15:00:03 +0200 Subject: [PATCH 1/4] add distgen support --- 8.0/README.md | 1 - .../share/container-scripts/mysql/README.md | 365 ----------------- 8.4/README.md | 1 - .../share/container-scripts/mysql/README.md | 366 ------------------ 8.4/s2i-common | 2 +- 8.4/test | 2 +- manifest.yml | 37 ++ specs/multispec.yml | 107 +++++ src/Dockerfile | 147 +++++++ 9 files changed, 293 insertions(+), 735 deletions(-) delete mode 120000 8.0/README.md delete mode 100644 8.0/root/usr/share/container-scripts/mysql/README.md delete mode 120000 8.4/README.md delete mode 100644 8.4/root/usr/share/container-scripts/mysql/README.md create mode 100644 manifest.yml create mode 100644 specs/multispec.yml create mode 100644 src/Dockerfile diff --git a/8.0/README.md b/8.0/README.md deleted file mode 120000 index cc942f07..00000000 --- a/8.0/README.md +++ /dev/null @@ -1 +0,0 @@ -root/usr/share/container-scripts/mysql/README.md \ No newline at end of file diff --git a/8.0/root/usr/share/container-scripts/mysql/README.md b/8.0/root/usr/share/container-scripts/mysql/README.md deleted file mode 100644 index e7bdaded..00000000 --- a/8.0/root/usr/share/container-scripts/mysql/README.md +++ /dev/null @@ -1,365 +0,0 @@ -MySQL 8.0 SQL Database Server container image -============================================= - -This container image includes MySQL 8.0 SQL database server for OpenShift and general usage. -Users can choose between RHEL, CentOS Stream and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available on [Quay.io/sclorg](https://quay.io/organization/sclorg), -and the Fedora images are available in [Fedora Registry](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments. - -Description ------------ - -This 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. -You can find more information on the MySQL project from the project Web site -(https://www.mysql.com/). - - -Usage ------ - -For this, we will assume that you are using the MySQL 8.0 container image from the -Red Hat Container Catalog called `rhel8/mysql-80`. -If you want to set only the mandatory environment variables and not store -the database in a host directory, execute the following command: - -``` -$ podman run -d --name mysql_database -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel8/mysql-80 -``` - -This will create a container named `mysql_database` running MySQL with database -`db` and user with credentials `user:pass`. Port 3306 will be exposed and mapped -to the host. If you want your database to be persistent across container executions, -also add a `-v /host/db/path:/var/lib/mysql/data` argument. This will be the MySQL -data directory. - -If the database directory is not initialized, the entrypoint script will first -run [`mysql_install_db`](https://dev.mysql.com/doc/refman/en/mysql-install-db.html) -and setup necessary database users and passwords. After the database is initialized, -or if it was already present, `mysqld` is executed and will run as PID 1. You can - stop the detached container by running `podman stop mysql_database`. - - -Environment variables and volumes ---------------------------------- - -The image recognizes the following environment variables that you can set during -initialization by passing `-e VAR=VALUE` to the Docker run command. - -**`MYSQL_USER`** - User name for MySQL account to be created - -**`MYSQL_PASSWORD`** - Password for the user account - -**`MYSQL_DATABASE`** - Database name - -**`MYSQL_ROOT_PASSWORD`** - Password for the root user (optional) - -**`MYSQL_CHARSET`** - Default character set (optional) - -**`MYSQL_COLLATION`** - Default collation (optional) - - -The following environment variables influence the MySQL configuration file. They are all optional. - -**`MYSQL_LOWER_CASE_TABLE_NAMES (default: 0)`** - Sets how the table names are stored and compared - -**`MYSQL_MAX_CONNECTIONS (default: 151)`** - The maximum permitted number of simultaneous client connections - -**`MYSQL_MAX_ALLOWED_PACKET (default: 200M)`** - The maximum size of one packet or any generated/intermediate string - -**`MYSQL_FT_MIN_WORD_LEN (default: 4)`** - The minimum length of the word to be included in a FULLTEXT index - -**`MYSQL_FT_MAX_WORD_LEN (default: 20)`** - The maximum length of the word to be included in a FULLTEXT index - -**`MYSQL_AIO (default: 1)`** - Controls the `innodb_use_native_aio` setting value in case the native AIO is broken. See http://help.directadmin.com/item.php?id=529 - -**`MYSQL_TABLE_OPEN_CACHE (default: 400)`** - The number of open tables for all threads - -**`MYSQL_KEY_BUFFER_SIZE (default: 32M or 10% of available memory)`** - The size of the buffer used for index blocks - -**`MYSQL_SORT_BUFFER_SIZE (default: 256K)`** - The size of the buffer used for sorting - -**`MYSQL_READ_BUFFER_SIZE (default: 8M or 5% of available memory)`** - The size of the buffer used for a sequential scan - -**`MYSQL_INNODB_BUFFER_POOL_SIZE (default: 32M or 50% of available memory)`** - The size of the buffer pool where InnoDB caches table and index data - -**`MYSQL_INNODB_LOG_FILE_SIZE (default: 8M or 15% of available memory)`** - The size of each log file in a log group - -**`MYSQL_INNODB_LOG_BUFFER_SIZE (default: 8M or 15% of available memory)`** - The size of the buffer that InnoDB uses to write to the log files on disk - -**`MYSQL_DEFAULTS_FILE (default: /etc/my.cnf)`** - Point to an alternative configuration file - -**`MYSQL_BINLOG_FORMAT (default: statement)`** - Set sets the binlog format, supported values are `row` and `statement` - -**`MYSQL_LOG_QUERIES_ENABLED (default: 0)`** - To enable query logging set this to `1` - -**`MYSQL_AUTHENTICATION_POLICY (default: 'caching_sha2_password,,')`** - Set authentication_policy. See https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin for more information. This option replaces deprecated MYSQL_DEFAULT_AUTHENTICATION_PLUGIN. - -**`MYSQL_DEFAULT_AUTHENTICATION_PLUGIN (deprecated; default: caching_sha2_password)`** - Set default authentication plugin. Accepts values `mysql_native_password` or `caching_sha2_password`. This option is deprecated, use `MYSQL_AUTHENTICATION_POLICY` instead. - -You can also set the following mount points by passing the `-v /host:/container` flag to Docker. - -**`/var/lib/mysql/data`** - MySQL data directory - - -**Notice: When mouting a directory from the host into the container, ensure that the mounted -directory has the appropriate permissions and that the owner and group of the directory -matches the user UID or name which is running inside the container.** - - -MySQL auto-tuning ------------------ - -When the MySQL image is run with the `--memory` parameter set and you didn't -specify value for some parameters, their values will be automatically -calculated based on the available memory. - -**`MYSQL_KEY_BUFFER_SIZE (default: 10%)`** - `key_buffer_size` - -**`MYSQL_READ_BUFFER_SIZE (default: 5%)`** - `read_buffer_size` - -**`MYSQL_INNODB_BUFFER_POOL_SIZE (default: 50%)`** - `innodb_buffer_pool_size` - -**`MYSQL_INNODB_LOG_FILE_SIZE (default: 15%)`** - `innodb_log_file_size` - -**`MYSQL_INNODB_LOG_BUFFER_SIZE (default: 15%)`** - `innodb_log_buffer_size` - - - -MySQL root user ---------------- -The root user has no password set by default, only allowing local connections. -You can set it by setting the `MYSQL_ROOT_PASSWORD` environment variable. This -will allow you to login to the root account remotely. Local connections will -still not require a password. - -To disable remote root access, simply unset `MYSQL_ROOT_PASSWORD` and restart -the container. - - -Changing passwords ------------------- - -Since passwords are part of the image configuration, the only supported method -to change passwords for the database user (`MYSQL_USER`) and root user is by -changing the environment variables `MYSQL_PASSWORD` and `MYSQL_ROOT_PASSWORD`, -respectively. - -Changing database passwords through SQL statements or any way other than through -the environment variables aforementioned will cause a mismatch between the -values stored in the variables and the actual passwords. Whenever a database -container starts it will reset the passwords to the values stored in the -environment variables. - - -Default my.cnf file -------------------- -With environment variables we are able to customize a lot of different parameters -or configurations for the mysql bootstrap configurations. If you'd prefer to use -your own configuration file, you can override the `MYSQL_DEFAULTS_FILE` env -variable with the full path of the file you wish to use. For example, the default -location is `/etc/my.cnf` but you can change it to `/etc/mysql/my.cnf` by setting - `MYSQL_DEFAULTS_FILE=/etc/mysql/my.cnf` - - -Extending image ---------------- -This image can be extended in Openshift using the `Source` build strategy or via the standalone -[source-to-image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) application (where available). -For this, we will assume that you are using the `rhel9/mysql-80` image, -available via `mysql:8.0` imagestream tag in Openshift. - - -For example, to build a customized MySQL database image `my-mysql-rhel9` -with a configuration from `https://github.com/sclorg/mysql-container/tree/master/examples/extend-image` run: - -``` -$ oc new-app mysql:8.0~https://github.com/sclorg/mysql-container.git \ - --name my-mysql-rhel9 \ - --context-dir=examples/extend-image \ - --env MYSQL_OPERATIONS_USER=opuser \ - --env MYSQL_OPERATIONS_PASSWORD=oppass \ - --env MYSQL_DATABASE=opdb \ - --env MYSQL_USER=user \ - --env MYSQL_PASSWORD=pass -``` - -or via s2i: - -``` -$ s2i build --context-dir=examples/extend-image https://github.com/sclorg/mysql-container.git rhel9/mysql-80 my-mysql-rhel9 -``` - -The directory passed to Openshift can contain these directories: - -`mysql-cfg/` - When starting the container, files from this directory will be used as - a configuration for the `mysqld` daemon. - `envsubst` command is run on this file to still allow customization of - the image using environmental variables - -`mysql-pre-init/` - Shell scripts (`*.sh`) available in this directory are sourced before - `mysqld` daemon is started. - -`mysql-init/` - Shell scripts (`*.sh`) available in this directory are sourced when - `mysqld` daemon is started locally. In this phase, use `${mysql_flags}` - to connect to the locally running daemon, for example `mysql $mysql_flags < dump.sql` - -Variables that can be used in the scripts provided to s2i: - -`$mysql_flags` - arguments for the `mysql` tool that will connect to the locally running `mysqld` during initialization - -`$MYSQL_RUNNING_AS_SOURCE` - variable defined when the container is run with `run-mysqld-source` command - -`$MYSQL_RUNNING_AS_REPLICA` - variable defined when the container is run with `run-mysqld-replica` command - -`$MYSQL_DATADIR_FIRST_INIT` - variable defined when the container was initialized from the empty data dir - -During the s2i build all provided files are copied into `/opt/app-root/src` -directory into the resulting image. If some configuration files are present -in the destination directory, files with the same name are overwritten. -Also only one file with the same name can be used for customization and user -provided files are preferred over default files in -`/usr/share/container-scripts/mysql/`- so it is possible to overwrite them. - -Same configuration directory structure can be used to customize the image -every time the image is started using `podman run`. The directory has to be -mounted into `/opt/app-root/src/` in the image -(`-v ./image-configuration/:/opt/app-root/src/`). -This overwrites customization built into the image. - - -Securing the connection with SSL --------------------------------- -In order to secure the connection with SSL, use the extending feature described -above. In particular, put the SSL certificates into a separate directory: - - sslapp/mysql-certs/server-cert-selfsigned.pem - sslapp/mysql-certs/server-key.pem - -And then put a separate configuration file into mysql-cfg: - - $> cat sslapp/mysql-cfg/ssl.cnf - [mysqld] - ssl-key=${APP_DATA}/mysql-certs/server-key.pem - ssl-cert=${APP_DATA}/mysql-certs/server-cert-selfsigned.pem - -Such a directory `sslapp` can then be mounted into the container with -v, -or a new container image can be built using s2i. - - -Upgrading and data directory version checking ---------------------------------------------- - -MySQL and MariaDB use versions that consist of three numbers X.Y.Z (e.g. 5.6.23). -For version changes in Z part, the server's binary data format stays compatible and thus no -special upgrade procedure is needed. For upgrades from X.Y to X.Y+z, consider doing manual -steps as described at -https://dev.mysql.com/doc/refman/8.0/en/upgrading-from-previous-series.html. - -Skipping LTS versions like 5.7 to 8.4 or downgrading to lower version is not supported. - -**Important**: Upgrading to a new version is always risky and users are expected to make a full -back-up of all data before. - -A safer solution to upgrade is to dump all data using `mysqldump` or `mysqldbexport` and then -load the data using `mysql` or `mysqldbimport` into an empty (freshly initialized) database. - -Another way of proceeding with the upgrade is starting the new version of the `mysqld` daemon. -This so called in-place upgrade is generally faster for large data directory, but only possible -if upgrading from the very previous LTS version, so skipping LTS versions is not supported. - -Starting 8.0.16, `mysql_upgrade` functionality was moved to the MySQL server itself and executes -all datadir actions automatically when necessary. After `mysql_upgrade` being labeled as deprecated -since this version, it is missing in MySQL 8.4.x entirely. Therefore, several values previously -used for the `MYSQL_DATADIR_ACTION` variable are No-op and server starts as usually. - -There are also some other actions that you may want to run at the beginning of the container start, -when the local daemon is running, no matter what version of the data is detected: - - * `optimize` -- runs `mysqlcheck --optimize`. It optimizes all the tables. - * `analyze` -- runs `mysqlcheck --analyze`. It analyzes all the tables. - -Multiple values are separated by comma and run in-order, e.g. `MYSQL_DATADIR_ACTION="optimize,analyze"`. - - -Changing the replication binlog_format --------------------------------------- -Some applications may wish to use `row` binlog_formats (for example, those built - with change-data-capture in mind). The default replication/binlog format is - `statement` but to change it you can set the `MYSQL_BINLOG_FORMAT` environment - variable. For example `MYSQL_BINLOG_FORMAT=row`. Now when you run the database - with `source/replica` replication turned on (ie, set the Docker/container `cmd` to be -`run-mysqld-source`) the binlog will emit the actual data for the rows that change -as opposed to the statements (ie, DML like insert...) that caused the change. - - -Changing the authentication plugin ----------------------------------- -MySQL 8.0 introduced 'caching_sha2_password' as its default authentication plugin. -It is faster and provides better security then the previous default authentication plugin. -However, not all software implements this algorithm, and client applications might report -issue like "The server requested authentication method". - -The plugin can be changed by setting `MYSQL_DEFAULT_AUTHENTICATION_PLUGIN` environment variable, -which accepts values `caching_sha2_password` (the default one) or `mysql_native_password`. -To change the behaviour back to the same behavior as MySQL 5.7 (for client applications that do not -support `caching_sha2_password`), set the `MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password`. - - -Troubleshooting ---------------- -The mysqld deamon in the container logs to the standard output, so the log is available in the container log. The log can be examined by running: - - podman logs - - -See also --------- -Dockerfile and other sources for this container image are available on -https://github.com/sclorg/mysql-container. -In that repository, the Dockerfile for RHEL8 is called Dockerfile.rhel8, -the Dockerfile for RHEL9 is called Dockerfile.rhel9, -the Dockerfile for CentOS Stream 9 is called Dockerfile.c9s, -and the Dockerfile for Fedora is called Dockerfile.fedora. diff --git a/8.4/README.md b/8.4/README.md deleted file mode 120000 index cc942f07..00000000 --- a/8.4/README.md +++ /dev/null @@ -1 +0,0 @@ -root/usr/share/container-scripts/mysql/README.md \ No newline at end of file diff --git a/8.4/root/usr/share/container-scripts/mysql/README.md b/8.4/root/usr/share/container-scripts/mysql/README.md deleted file mode 100644 index f99b972f..00000000 --- a/8.4/root/usr/share/container-scripts/mysql/README.md +++ /dev/null @@ -1,366 +0,0 @@ -MySQL 8.4 SQL Database Server container image -============================================= - -This container image includes MySQL 8.4 SQL database server for OpenShift and general usage. -Users can choose between RHEL, CentOS Stream and Fedora based images. -The RHEL images are available in the [Red Hat Container Catalog](https://access.redhat.com/containers/), -the CentOS Stream images are available on [Quay.io/sclorg](https://quay.io/organization/sclorg), -and the Fedora images are available in [Fedora Registry](https://quay.io/organization/fedora). -The resulting image can be run using [podman](https://github.com/containers/libpod). - -Note: while the examples in this README are calling `podman`, you can replace any such calls by `docker` with the same arguments. - -Description ------------ - -This 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. -You can find more information on the MySQL project from the project Web site -(https://www.mysql.com/). - - -Usage ------ - -For this, we will assume that you are using the MySQL 8.4 container image from the -Red Hat Container Catalog called `rhel9/mysql-84`. -If you want to set only the mandatory environment variables and not store -the database in a host directory, execute the following command: - -``` -$ podman run -d --name mysql_database -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel10/mysql-84 -``` - -This will create a container named `mysql_database` running MySQL with database -`db` and user with credentials `user:pass`. Port 3306 will be exposed and mapped -to the host. If you want your database to be persistent across container executions, -also add a `-v /host/db/path:/var/lib/mysql/data` argument. This will be the MySQL -data directory. - -If the database directory is not initialized, the entrypoint script will first -run [`mysql_install_db`](https://dev.mysql.com/doc/refman/en/mysql-install-db.html) -and setup necessary database users and passwords. After the database is initialized, -or if it was already present, `mysqld` is executed and will run as PID 1. You can - stop the detached container by running `podman stop mysql_database`. - - -Environment variables and volumes ---------------------------------- - -The image recognizes the following environment variables that you can set during -initialization by passing `-e VAR=VALUE` to the Docker run command. - -**`MYSQL_USER`** - User name for MySQL account to be created - -**`MYSQL_PASSWORD`** - Password for the user account - -**`MYSQL_DATABASE`** - Database name - -**`MYSQL_ROOT_PASSWORD`** - Password for the root user (optional) - -**`MYSQL_CHARSET`** - Default character set (optional) - -**`MYSQL_COLLATION`** - Default collation (optional) - - -The following environment variables influence the MySQL configuration file. They are all optional. - -**`MYSQL_LOWER_CASE_TABLE_NAMES (default: 0)`** - Sets how the table names are stored and compared - -**`MYSQL_MAX_CONNECTIONS (default: 151)`** - The maximum permitted number of simultaneous client connections - -**`MYSQL_MAX_ALLOWED_PACKET (default: 200M)`** - The maximum size of one packet or any generated/intermediate string - -**`MYSQL_FT_MIN_WORD_LEN (default: 4)`** - The minimum length of the word to be included in a FULLTEXT index - -**`MYSQL_FT_MAX_WORD_LEN (default: 20)`** - The maximum length of the word to be included in a FULLTEXT index - -**`MYSQL_AIO (default: 1)`** - Controls the `innodb_use_native_aio` setting value in case the native AIO is broken. See http://help.directadmin.com/item.php?id=529 - -**`MYSQL_TABLE_OPEN_CACHE (default: 400)`** - The number of open tables for all threads - -**`MYSQL_KEY_BUFFER_SIZE (default: 32M or 10% of available memory)`** - The size of the buffer used for index blocks - -**`MYSQL_SORT_BUFFER_SIZE (default: 256K)`** - The size of the buffer used for sorting - -**`MYSQL_READ_BUFFER_SIZE (default: 8M or 5% of available memory)`** - The size of the buffer used for a sequential scan - -**`MYSQL_INNODB_BUFFER_POOL_SIZE (default: 32M or 50% of available memory)`** - The size of the buffer pool where InnoDB caches table and index data - -**`MYSQL_INNODB_LOG_FILE_SIZE (default: 8M or 15% of available memory)`** - The size of each log file in a log group - -**`MYSQL_INNODB_LOG_BUFFER_SIZE (default: 8M or 15% of available memory)`** - The size of the buffer that InnoDB uses to write to the log files on disk - -**`MYSQL_DEFAULTS_FILE (default: /etc/my.cnf)`** - Point to an alternative configuration file - -**`MYSQL_BINLOG_FORMAT (default: statement)`** - Set sets the binlog format, supported values are `row` and `statement` - -**`MYSQL_LOG_QUERIES_ENABLED (default: 0)`** - To enable query logging set this to `1` - -**`MYSQL_AUTHENTICATION_POLICY (default: 'caching_sha2_password,,')`** - Set authentication_policy. See https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin for more information. This option replaces deprecated MYSQL_DEFAULT_AUTHENTICATION_PLUGIN. - -**`MYSQL_DEFAULT_AUTHENTICATION_PLUGIN (deprecated; default: caching_sha2_password)`** - Set default authentication plugin. Accepts values `mysql_native_password` or `caching_sha2_password`. This option is deprecated, use `MYSQL_AUTHENTICATION_POLICY` instead. - -You can also set the following mount points by passing the `-v /host:/container` flag to Docker. - -**`/var/lib/mysql/data`** - MySQL data directory - - -**Notice: When mouting a directory from the host into the container, ensure that the mounted -directory has the appropriate permissions and that the owner and group of the directory -matches the user UID or name which is running inside the container.** - - -MySQL auto-tuning ------------------ - -When the MySQL image is run with the `--memory` parameter set and you didn't -specify value for some parameters, their values will be automatically -calculated based on the available memory. - -**`MYSQL_KEY_BUFFER_SIZE (default: 10%)`** - `key_buffer_size` - -**`MYSQL_READ_BUFFER_SIZE (default: 5%)`** - `read_buffer_size` - -**`MYSQL_INNODB_BUFFER_POOL_SIZE (default: 50%)`** - `innodb_buffer_pool_size` - -**`MYSQL_INNODB_LOG_FILE_SIZE (default: 15%)`** - `innodb_log_file_size` - -**`MYSQL_INNODB_LOG_BUFFER_SIZE (default: 15%)`** - `innodb_log_buffer_size` - - - -MySQL root user ---------------- -The root user has no password set by default, only allowing local connections. -You can set it by setting the `MYSQL_ROOT_PASSWORD` environment variable. This -will allow you to login to the root account remotely. Local connections will -still not require a password. - -To disable remote root access, simply unset `MYSQL_ROOT_PASSWORD` and restart -the container. - - -Changing passwords ------------------- - -Since passwords are part of the image configuration, the only supported method -to change passwords for the database user (`MYSQL_USER`) and root user is by -changing the environment variables `MYSQL_PASSWORD` and `MYSQL_ROOT_PASSWORD`, -respectively. - -Changing database passwords through SQL statements or any way other than through -the environment variables aforementioned will cause a mismatch between the -values stored in the variables and the actual passwords. Whenever a database -container starts it will reset the passwords to the values stored in the -environment variables. - - -Default my.cnf file -------------------- -With environment variables we are able to customize a lot of different parameters -or configurations for the mysql bootstrap configurations. If you'd prefer to use -your own configuration file, you can override the `MYSQL_DEFAULTS_FILE` env -variable with the full path of the file you wish to use. For example, the default -location is `/etc/my.cnf` but you can change it to `/etc/mysql/my.cnf` by setting - `MYSQL_DEFAULTS_FILE=/etc/mysql/my.cnf` - - -Extending image ---------------- -This image can be extended in Openshift using the `Source` build strategy or via the standalone -[source-to-image](https://docs.openshift.com/container-platform/4.14/openshift_images/create-images.html#images-create-s2i_create-images) application (where available). -For this, we will assume that you are using the `rhel10/mysql-84` image, -available via `mysql:8.4` imagestream tag in Openshift. - - -For example, to build a customized MySQL database image `my-mysql-rhel10` -with a configuration from `https://github.com/sclorg/mysql-container/tree/master/examples/extend-image` run: - -``` -$ oc new-app mysql:8.4~https://github.com/sclorg/mysql-container.git \ - --name my-mysql-rhel10 \ - --context-dir=examples/extend-image \ - --env MYSQL_OPERATIONS_USER=opuser \ - --env MYSQL_OPERATIONS_PASSWORD=oppass \ - --env MYSQL_DATABASE=opdb \ - --env MYSQL_USER=user \ - --env MYSQL_PASSWORD=pass -``` - -or via s2i: - -``` -$ s2i build --context-dir=examples/extend-image https://github.com/sclorg/mysql-container.git rhel10/mysql-84 my-mysql-rhel10 -``` - -The directory passed to Openshift can contain these directories: - -`mysql-cfg/` - When starting the container, files from this directory will be used as - a configuration for the `mysqld` daemon. - `envsubst` command is run on this file to still allow customization of - the image using environmental variables - -`mysql-pre-init/` - Shell scripts (`*.sh`) available in this directory are sourced before - `mysqld` daemon is started. - -`mysql-init/` - Shell scripts (`*.sh`) available in this directory are sourced when - `mysqld` daemon is started locally. In this phase, use `${mysql_flags}` - to connect to the locally running daemon, for example `mysql $mysql_flags < dump.sql` - -Variables that can be used in the scripts provided to s2i: - -`$mysql_flags` - arguments for the `mysql` tool that will connect to the locally running `mysqld` during initialization - -`$MYSQL_RUNNING_AS_SOURCE` - variable defined when the container is run with `run-mysqld-source` command - -`$MYSQL_RUNNING_AS_REPLICA` - variable defined when the container is run with `run-mysqld-replica` command - -`$MYSQL_DATADIR_FIRST_INIT` - variable defined when the container was initialized from the empty data dir - -During the s2i build all provided files are copied into `/opt/app-root/src` -directory into the resulting image. If some configuration files are present -in the destination directory, files with the same name are overwritten. -Also only one file with the same name can be used for customization and user -provided files are preferred over default files in -`/usr/share/container-scripts/mysql/`- so it is possible to overwrite them. - -Same configuration directory structure can be used to customize the image -every time the image is started using `podman run`. The directory has to be -mounted into `/opt/app-root/src/` in the image -(`-v ./image-configuration/:/opt/app-root/src/`). -This overwrites customization built into the image. - - -Securing the connection with SSL --------------------------------- -In order to secure the connection with SSL, use the extending feature described -above. In particular, put the SSL certificates into a separate directory: - - sslapp/mysql-certs/server-cert-selfsigned.pem - sslapp/mysql-certs/server-key.pem - -And then put a separate configuration file into mysql-cfg: - - $> cat sslapp/mysql-cfg/ssl.cnf - [mysqld] - ssl-key=${APP_DATA}/mysql-certs/server-key.pem - ssl-cert=${APP_DATA}/mysql-certs/server-cert-selfsigned.pem - -Such a directory `sslapp` can then be mounted into the container with -v, -or a new container image can be built using s2i. - - -Upgrading and data directory version checking ---------------------------------------------- - -MySQL and MariaDB use versions that consist of three numbers X.Y.Z (e.g. 5.6.23). -For version changes in Z part, the server's binary data format stays compatible and thus no -special upgrade procedure is needed. For upgrades from X.Y to X.Y+z, consider doing manual -steps as described at -https://dev.mysql.com/doc/refman/8.4/en/mysql-nutshell.html. - -Skipping LTS versions like 5.7 to 8.4 or downgrading to lower version is not supported. - -**Important**: Upgrading to a new version is always risky and users are expected to make a full -back-up of all data before. - -A safer solution to upgrade is to dump all data using `mysqldump` or `mysqldbexport` and then -load the data using `mysql` or `mysqldbimport` into an empty (freshly initialized) database. - -Another way of proceeding with the upgrade is starting the new version of the `mysqld` daemon. -This so called in-place upgrade is generally faster for large data directory, but only possible -if upgrading from the very previous LTS version, so skipping LTS versions is not supported. - -Starting 8.0.16, `mysql_upgrade` functionality was moved to the MySQL server itself and executes -all datadir actions automatically when necessary. After `mysql_upgrade` being labeled as deprecated -since this version, it is missing in MySQL 8.4.x entirely. Therefore, several values previously -used for the `MYSQL_DATADIR_ACTION` variable are No-op and server starts as usually. - -There are also some other actions that you may want to run at the beginning of the container start, -when the local daemon is running, no matter what version of the data is detected: - - * `optimize` -- runs `mysqlcheck --optimize`. It optimizes all the tables. - * `analyze` -- runs `mysqlcheck --analyze`. It analyzes all the tables. - -Multiple values are separated by comma and run in-order, e.g. `MYSQL_DATADIR_ACTION="optimize,analyze"`. - - -Changing the replication binlog_format --------------------------------------- -Some applications may wish to use `row` binlog_formats (for example, those built - with change-data-capture in mind). The default replication/binlog format is - `statement` but to change it you can set the `MYSQL_BINLOG_FORMAT` environment - variable. For example `MYSQL_BINLOG_FORMAT=row`. Now when you run the database - with `source/replica` replication turned on (ie, set the Docker/container `cmd` to be -`run-mysqld-source`) the binlog will emit the actual data for the rows that change -as opposed to the statements (ie, DML like insert...) that caused the change. - - -Changing the authentication plugin ----------------------------------- -MySQL 8.0 introduced 'caching_sha2_password' as its default authentication plugin. -It is faster and provides better security then the previous default authentication plugin. -However, not all software implements this algorithm, and client applications might report -issue like "The server requested authentication method". - -The plugin can be changed by setting `MYSQL_DEFAULT_AUTHENTICATION_PLUGIN` environment variable, -which accepts values `caching_sha2_password` (the default one) or `mysql_native_password`. -To change the behaviour back to the same behavior as MySQL 5.7 (for client applications that do not -support `caching_sha2_password`), set the `MYSQL_DEFAULT_AUTHENTICATION_PLUGIN=mysql_native_password`. - - -Troubleshooting ---------------- -The mysqld deamon in the container logs to the standard output, so the log is available in the container log. The log can be examined by running: - - podman logs - - -See also --------- -Dockerfile and other sources for this container image are available on -https://github.com/sclorg/mysql-container. -In that repository, the Dockerfile for RHEL9 is called Dockerfile.rhel9, -the Dockerfile for RHEL 10 is called Dockerfile.rhel10, -the Dockerfile for CentOS Stream 9 is called Dockerfile.c9s, -the Dockerfile for CentOS Stream 10 is called Dockerfile.c10s, -and the Dockerfile for Fedora is called Dockerfile.fedora. diff --git a/8.4/s2i-common b/8.4/s2i-common index 49d966b0..51722ec3 120000 --- a/8.4/s2i-common +++ b/8.4/s2i-common @@ -1 +1 @@ -../s2i-common/ \ No newline at end of file +../s2i-common \ No newline at end of file diff --git a/8.4/test b/8.4/test index ae78e219..419df4f9 120000 --- a/8.4/test +++ b/8.4/test @@ -1 +1 @@ -../test/ \ No newline at end of file +../test \ No newline at end of file diff --git a/manifest.yml b/manifest.yml new file mode 100644 index 00000000..b181d8c1 --- /dev/null +++ b/manifest.yml @@ -0,0 +1,37 @@ +# Manifest for image directories creation +# every dest path will be prefixed by $DESTDIR/$version + +# Files containing distgen directives, which are used for each +# (distro, version) combination not excluded in multispec +DISTGEN_MULTI_RULES: + - src: src/Dockerfile + dest: Dockerfile.fedora + + - src: src/Dockerfile + dest: Dockerfile.rhel8 + + - src: src/Dockerfile + dest: Dockerfile.rhel9 + + - src: src/Dockerfile + dest: Dockerfile.rhel10 + + - src: src/Dockerfile + dest: Dockerfile.c9s + + - src: src/Dockerfile + dest: Dockerfile.c10s + + +# Symbolic links +# This section is the last one on purpose because the generator.py +# does not allow dead symlinks. +SYMLINK_RULES: + - src: ../root-common + dest: root-common + + - src: ../s2i-common + dest: s2i-common + + - src: ../test + dest: test diff --git a/specs/multispec.yml b/specs/multispec.yml new file mode 100644 index 00000000..97000f28 --- /dev/null +++ b/specs/multispec.yml @@ -0,0 +1,107 @@ +version: 1 + +specs: + distroinfo: + fedora42: + distros: + - fedora-42-x86_64 + s2i_base: quay.io/fedora/s2i-core:42 + org: "fedora" + prod: "fedora" + img_name: "fedora/${NAME}-${MYSQL_SHORT_VERSION}" + pkgs: "rsync tar gettext hostname groff-base policycoreutils" + pkg_manager: "dnf" + environment_setup: "" + chown_group: "root" + license_terms: "" + + rhel8: + distros: + - rhel-8-x86_64 + s2i_base: ubi8/s2i-core + org: "rhel8" + prod: "rhel8" + img_name: "rhel8/mysql-{{ spec.short }}" + pkgs: "policycoreutils rsync tar gettext hostname groff-base mysql-server" + pkg_manager: "yum" + environment_setup: "" + chown_group: "0" + license_terms: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" + + rhel9: + distros: + - rhel-9-x86_64 + s2i_base: ubi9/s2i-core + org: "rhel9" + prod: "rhel9" + img_name: "rhel9/${NAME}-${MYSQL_SHORT_VERSION}" + pkgs: "policycoreutils rsync tar gettext hostname bind9.18-utils groff-base ${NAME}-server" + pkg_manager: "yum" + environment_setup: "" + chown_group: "root" + license_terms: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" + + rhel10: + distros: + - rhel-10-x86_64 + s2i_base: ubi10/s2i-core:latest + org: "rhel10" + prod: "rhel10" + img_name: "rhel10/${NAME}-${MYSQL_SHORT_VERSION}" + pkgs: "policycoreutils rsync tar gettext hostname groff-base procps-ng" + pkg_manager: "dnf" + environment_setup: "" + chown_group: "root" + license_terms: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" + + c9s: + distros: + - centos-stream-9-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c9s:c9s + org: "sclorg" + prod: "c9s" + img_name: "sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s" + pkgs: "policycoreutils rsync tar gettext hostname groff-base ${NAME}-server" + pkg_manager: "yum" + environment_setup: "" + chown_group: "root" + license_terms: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" + + c10s: + distros: + - centos-stream-10-x86_64 + s2i_base: quay.io/sclorg/s2i-core-c10s:c10s + org: "sclorg" + prod: "c10s" + img_name: "sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c10s" + pkgs: "policycoreutils rsync tar gettext hostname groff-base procps-ng" + pkg_manager: "dnf" + environment_setup: "" + chown_group: "root" + license_terms: "https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" + + version: + "8.0": + version: "8.0" + short: "80" + + "8.4": + version: "8.4" + short: "84" + +matrix: + include: + - version: "8.0" + distros: + - fedora-42-x86_64 + - rhel-8-x86_64 + - rhel-9-x86_64 + - centos-stream-9-x86_64 + + - version: "8.4" + distros: + - fedora-42-x86_64 + - rhel-9-x86_64 + - rhel-10-x86_64 + - centos-stream-9-x86_64 + - centos-stream-10-x86_64 diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100644 index 00000000..f1e9a951 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,147 @@ +FROM {{ spec.s2i_base }} + +# 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 + +{% if spec.prod == 'rhel8' and spec.version == '8.0' %}ENV MYSQL_VERSION={{ spec.version }} \ + APP_DATA=/opt/app-root/src \ + HOME=/var/lib/mysql + +ENV SUMMARY="MySQL {{ spec.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." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="MySQL {{ spec.version }}" \ + io.openshift.expose-services="3306:mysql" \ + io.openshift.tags="database,mysql,mysql{{ spec.short }},mysql-{{ spec.short }}" \ + com.redhat.component="mysql-{{ spec.short }}-container" \ + name="{{ spec.img_name }}" \ + version="1" \ +{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ +{% endif %} usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 {{ spec.img_name }}" \ + maintainer="SoftwareCollections.org " +{% else %}# Standalone ENV call so these values can be re-used in the other ENV calls +ENV MYSQL_VERSION={{ spec.version }} \ + MYSQL_SHORT_VERSION={{ spec.short }} + +ENV APP_DATA=/opt/app-root/src \ + HOME=/var/lib/mysql \ + NAME=mysql \ + 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." + +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,${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 %}" \ + 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 %}" \ + name="{{ spec.img_name }}" \ +{% if spec.prod == 'fedora' %} version="${MYSQL_VERSION}" \ +{% elif spec.prod != 'rhel10' %} version="1" \ +{% endif %}{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ +{% 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 %}" \ + maintainer="SoftwareCollections.org " +{% endif %} + +EXPOSE 3306 + +{% 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. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed +{% else %}# 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. +{% endif %}{% if spec.prod == 'fedora' %}RUN /usr/sbin/groupadd -g 27 -o -r mysql && \ + /usr/sbin/useradd -M -N -g mysql -o -r -d ${HOME} -s /sbin/nologin -c "MySQL Server" -u 27 mysql && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" && \ + INSTALL_PKGS="{{ spec.pkgs }}" && \ + dnf install -y --setopt=tsflags=nodocs --setopt=install_weak_deps=False ${INSTALL_PKGS} ${NAME}${MYSQL_VERSION}-server && \ + dnf -y clean all --enablerepo='*' && \ + mkdir -p ${HOME}/data && chown -R mysql{% if spec.version == '8.0' %}.0{% else %}:root{% endif %} ${HOME} && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" +{% elif spec.prod == 'rhel8' and spec.version == '8.0' %}RUN yum -y module enable mysql:$MYSQL_VERSION && \ + INSTALL_PKGS="{{ spec.pkgs }}" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum -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)" +{% elif (spec.prod == 'rhel9' or spec.prod == 'c9s') and spec.version == '8.4' %}RUN yum -y module enable ${NAME}:${MYSQL_VERSION} && \ + INSTALL_PKGS="{{ spec.pkgs }}" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + rpm -V ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ + mkdir -p ${HOME}/data && chown -R mysql:{{ spec.chown_group }} ${HOME} && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" +{% elif spec.version == '8.0' %}RUN INSTALL_PKGS="{{ spec.pkgs }}" && \ + yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + rpm -V ${INSTALL_PKGS} && \ + yum -y clean all --enablerepo='*' && \ + mkdir -p ${HOME}/data && chown -R mysql.0 ${HOME} && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" +{% elif spec.prod == 'rhel10' or spec.prod == 'c10s' %}RUN INSTALL_PKGS="{{ spec.pkgs }}" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} ${NAME}${MYSQL_VERSION}-server && \ + dnf -y clean all --enablerepo='*' && \ + mkdir -p ${HOME}/data && chown -R mysql:{{ spec.chown_group }} ${HOME} && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" +{% else %}RUN INSTALL_PKGS="{{ spec.pkgs }}" && \ + dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ + rpm -V ${INSTALL_PKGS} && \ + dnf -y clean all --enablerepo='*' && \ + mkdir -p ${HOME}/data && chown -R mysql:{{ spec.chown_group }} ${HOME} && \ + test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" +{% endif %} + +# 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 + +{% if spec.prod == 'rhel8' and spec.version == '8.0' %}COPY {{ spec.version }}/root-common / +COPY {{ spec.version }}/s2i-common/bin/ $STI_SCRIPTS_PATH +COPY {{ spec.version }}/root / +{% else %}COPY ${MYSQL_VERSION}/root-common / +COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} +COPY ${MYSQL_VERSION}/root / +{% endif %} + +# 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 +{% if spec.prod == 'rhel8' and spec.version == '8.0' %}RUN ln -s /bin/run-mysqld $STI_SCRIPTS_PATH/run +{% else %}RUN ln -s /bin/run-mysqld ${STI_SCRIPTS_PATH}/run +{% endif %} + +# 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 +{% if spec.prod == 'rhel8' and spec.version == '8.0' %}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" +{% else %}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}" +{% endif %} + +USER 27 + +ENTRYPOINT ["container-entrypoint"] +CMD ["run-mysqld"] From 195e3fab9fbe160f7919102593541d7b48b72ec1 Mon Sep 17 00:00:00 2001 From: Nikola Davidova Date: Thu, 28 May 2026 16:46:34 +0200 Subject: [PATCH 2/4] add distgen-check in github workflow --- .github/workflows/container-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/container-tests.yml b/.github/workflows/container-tests.yml index 0beccd96..9829532f 100644 --- a/.github/workflows/container-tests.yml +++ b/.github/workflows/container-tests.yml @@ -3,6 +3,8 @@ on: types: - created jobs: + distgen-check: + uses: "sclorg/ci-actions/.github/workflows/distgen-check.yml@main" check-readme: uses: "sclorg/ci-actions/.github/workflows/check-readme.yml@main" container-tests: From 9283c5c9f08cbcf238c3168e179a673294678734 Mon Sep 17 00:00:00 2001 From: Nikola Davidova Date: Mon, 1 Jun 2026 11:51:08 +0200 Subject: [PATCH 3/4] cleanup Dockerfile --- 8.0/Dockerfile.c9s | 13 +++++----- 8.0/Dockerfile.fedora | 6 ++--- 8.0/Dockerfile.rhel8 | 34 +++++++++++++------------- 8.0/Dockerfile.rhel9 | 13 +++++----- 8.4/Dockerfile.c10s | 13 +++++----- 8.4/Dockerfile.c9s | 13 +++++----- 8.4/Dockerfile.fedora | 6 ++--- 8.4/Dockerfile.rhel10 | 12 +++++----- 8.4/Dockerfile.rhel9 | 13 +++++----- src/Dockerfile | 56 +++++++------------------------------------ 10 files changed, 69 insertions(+), 110 deletions(-) diff --git a/8.0/Dockerfile.c9s b/8.0/Dockerfile.c9s index 8da25e3a..20307315 100644 --- a/8.0/Dockerfile.c9s +++ b/8.0/Dockerfile.c9s @@ -31,16 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s:c9s" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base ${NAME}-server" && \ yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ rpm -V ${INSTALL_PKGS} && \ @@ -52,9 +51,9 @@ RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base ${NAME}- ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +COPY 8.0/root-common / +COPY 8.0/s2i-common/bin/ ${STI_SCRIPTS_PATH} +COPY 8.0/root / # Hard links are not supported in Testing Farm approach during sync to guest # operation system. Therefore tests are failing on error diff --git a/8.0/Dockerfile.fedora b/8.0/Dockerfile.fedora index 3f1fc307..4cfd362f 100644 --- a/8.0/Dockerfile.fedora +++ b/8.0/Dockerfile.fedora @@ -52,9 +52,9 @@ RUN /usr/sbin/groupadd -g 27 -o -r mysql && \ ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +COPY 8.0/root-common / +COPY 8.0/s2i-common/bin/ ${STI_SCRIPTS_PATH} +COPY 8.0/root / # Hard links are not supported in Testing Farm approach during sync to guest # operation system. Therefore tests are failing on error diff --git a/8.0/Dockerfile.rhel8 b/8.0/Dockerfile.rhel8 index 444bc6aa..b26afbb7 100644 --- a/8.0/Dockerfile.rhel8 +++ b/8.0/Dockerfile.rhel8 @@ -10,34 +10,36 @@ FROM ubi8/s2i-core # * $MYSQL_DATABASE - Name of the database to create # * $MYSQL_ROOT_PASSWORD (Optional) - Password for the 'root' MySQL account +# Standalone ENV call so these values can be re-used in the other ENV calls ENV MYSQL_VERSION=8.0 \ - APP_DATA=/opt/app-root/src \ - HOME=/var/lib/mysql + MYSQL_SHORT_VERSION=80 -ENV SUMMARY="MySQL 8.0 SQL database server" \ +ENV APP_DATA=/opt/app-root/src \ + HOME=/var/lib/mysql \ + NAME=mysql \ + 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." -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="MySQL 8.0" \ +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,mysql80,mysql-80" \ - com.redhat.component="mysql-80-container" \ + io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ + com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel8/mysql-80" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel8/mysql-80" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN yum -y module enable mysql:$MYSQL_VERSION && \ INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base mysql-server" && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ @@ -51,13 +53,13 @@ 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/s2i-common/bin/ ${STI_SCRIPTS_PATH} COPY 8.0/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 +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 @@ -66,7 +68,7 @@ RUN ln -s /bin/run-mysqld $STI_SCRIPTS_PATH/run 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" + /usr/libexec/mysqld -V | grep -qe "${MYSQL_VERSION}\." && echo "Found VERSION ${MYSQL_VERSION}" USER 27 diff --git a/8.0/Dockerfile.rhel9 b/8.0/Dockerfile.rhel9 index 5f9d8b7a..0925ce18 100644 --- a/8.0/Dockerfile.rhel9 +++ b/8.0/Dockerfile.rhel9 @@ -31,16 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind9.18-utils groff-base ${NAME}-server" && \ yum install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ rpm -V ${INSTALL_PKGS} && \ @@ -52,9 +51,9 @@ RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind9.18-utils grof ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +COPY 8.0/root-common / +COPY 8.0/s2i-common/bin/ ${STI_SCRIPTS_PATH} +COPY 8.0/root / # Hard links are not supported in Testing Farm approach during sync to guest # operation system. Therefore tests are failing on error diff --git a/8.4/Dockerfile.c10s b/8.4/Dockerfile.c10s index da95e7f7..7a3305f9 100644 --- a/8.4/Dockerfile.c10s +++ b/8.4/Dockerfile.c10s @@ -31,16 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c10s" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c10s:c10s" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base procps-ng" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} ${NAME}${MYSQL_VERSION}-server && \ dnf -y clean all --enablerepo='*' && \ @@ -51,9 +50,9 @@ RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base procps-n ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +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 diff --git a/8.4/Dockerfile.c9s b/8.4/Dockerfile.c9s index 9345708b..4f00e122 100644 --- a/8.4/Dockerfile.c9s +++ b/8.4/Dockerfile.c9s @@ -31,16 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s:c9s" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN yum -y module enable ${NAME}:${MYSQL_VERSION} && \ INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base ${NAME}-server" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ @@ -53,9 +52,9 @@ RUN yum -y module enable ${NAME}:${MYSQL_VERSION} && \ ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +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 diff --git a/8.4/Dockerfile.fedora b/8.4/Dockerfile.fedora index c20dca33..7a28da53 100644 --- a/8.4/Dockerfile.fedora +++ b/8.4/Dockerfile.fedora @@ -52,9 +52,9 @@ RUN /usr/sbin/groupadd -g 27 -o -r mysql && \ ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +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 diff --git a/8.4/Dockerfile.rhel10 b/8.4/Dockerfile.rhel10 index 858b9f47..bd564aed 100644 --- a/8.4/Dockerfile.rhel10 +++ b/8.4/Dockerfile.rhel10 @@ -31,15 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel10/${NAME}-${MYSQL_SHORT_VERSION}" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel10/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base procps-ng" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} ${NAME}${MYSQL_VERSION}-server && \ dnf -y clean all --enablerepo='*' && \ @@ -50,9 +50,9 @@ RUN INSTALL_PKGS="policycoreutils rsync tar gettext hostname groff-base procps-n ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +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 diff --git a/8.4/Dockerfile.rhel9 b/8.4/Dockerfile.rhel9 index 16ad925c..1a691f1b 100644 --- a/8.4/Dockerfile.rhel9 +++ b/8.4/Dockerfile.rhel9 @@ -31,16 +31,15 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ - version="1" \ + version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. +# Instead of relying on the DB server package, we will do the setup ourselves before any package is installed RUN yum -y module enable ${NAME}:${MYSQL_VERSION} && \ INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind9.18-utils groff-base ${NAME}-server" && \ dnf install -y --setopt=tsflags=nodocs ${INSTALL_PKGS} && \ @@ -53,9 +52,9 @@ RUN yum -y module enable ${NAME}:${MYSQL_VERSION} && \ ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / +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 diff --git a/src/Dockerfile b/src/Dockerfile index f1e9a951..a1d0d277 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -10,29 +10,7 @@ FROM {{ spec.s2i_base }} # * $MYSQL_DATABASE - Name of the database to create # * $MYSQL_ROOT_PASSWORD (Optional) - Password for the 'root' MySQL account -{% if spec.prod == 'rhel8' and spec.version == '8.0' %}ENV MYSQL_VERSION={{ spec.version }} \ - APP_DATA=/opt/app-root/src \ - HOME=/var/lib/mysql - -ENV SUMMARY="MySQL {{ spec.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." - -LABEL summary="$SUMMARY" \ - description="$DESCRIPTION" \ - io.k8s.description="$DESCRIPTION" \ - io.k8s.display-name="MySQL {{ spec.version }}" \ - io.openshift.expose-services="3306:mysql" \ - io.openshift.tags="database,mysql,mysql{{ spec.short }},mysql-{{ spec.short }}" \ - com.redhat.component="mysql-{{ spec.short }}-container" \ - name="{{ spec.img_name }}" \ - version="1" \ -{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ -{% endif %} usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 {{ spec.img_name }}" \ - maintainer="SoftwareCollections.org " -{% else %}# Standalone ENV call so these values can be re-used in the other ENV calls +# Standalone ENV call so these values can be re-used in the other ENV calls ENV MYSQL_VERSION={{ spec.version }} \ MYSQL_SHORT_VERSION={{ spec.short }} @@ -53,21 +31,16 @@ LABEL summary="${SUMMARY}" \ 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 %}" \ 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 %}" \ name="{{ spec.img_name }}" \ -{% if spec.prod == 'fedora' %} version="${MYSQL_VERSION}" \ -{% elif spec.prod != 'rhel10' %} version="1" \ -{% endif %}{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ + version="${MYSQL_VERSION}" \ +{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ {% 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 %}" \ maintainer="SoftwareCollections.org " -{% endif %} EXPOSE 3306 -{% 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. +# This image must forever use UID 27 for mysql user so our volumes are safe in the future. This should *never* change. # Instead of relying on the DB server package, we will do the setup ourselves before any package is installed -{% else %}# 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. -{% endif %}{% if spec.prod == 'fedora' %}RUN /usr/sbin/groupadd -g 27 -o -r mysql && \ +{% if spec.prod == 'fedora' %}RUN /usr/sbin/groupadd -g 27 -o -r mysql && \ /usr/sbin/useradd -M -N -g mysql -o -r -d ${HOME} -s /sbin/nologin -c "MySQL Server" -u 27 mysql && \ test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)" && \ INSTALL_PKGS="{{ spec.pkgs }}" && \ @@ -112,34 +85,23 @@ EXPOSE 3306 ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/mysql \ MYSQL_PREFIX=/usr -{% if spec.prod == 'rhel8' and spec.version == '8.0' %}COPY {{ spec.version }}/root-common / -COPY {{ spec.version }}/s2i-common/bin/ $STI_SCRIPTS_PATH +COPY {{ spec.version }}/root-common / +COPY {{ spec.version }}/s2i-common/bin/ ${STI_SCRIPTS_PATH} COPY {{ spec.version }}/root / -{% else %}COPY ${MYSQL_VERSION}/root-common / -COPY ${MYSQL_VERSION}/s2i-common/bin/ ${STI_SCRIPTS_PATH} -COPY ${MYSQL_VERSION}/root / -{% endif %} # 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 -{% if spec.prod == 'rhel8' and spec.version == '8.0' %}RUN ln -s /bin/run-mysqld $STI_SCRIPTS_PATH/run -{% else %}RUN ln -s /bin/run-mysqld ${STI_SCRIPTS_PATH}/run -{% endif %} +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 -{% if spec.prod == 'rhel8' and spec.version == '8.0' %}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" -{% else %}RUN rm -rf /etc/my.cnf.d/* && \ +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}" -{% endif %} USER 27 From 0eda79b6f5d36cad630509096a91b0e70f776c79 Mon Sep 17 00:00:00 2001 From: Nikola Davidova Date: Tue, 9 Jun 2026 15:45:52 +0200 Subject: [PATCH 4/4] minimize changes to dockerfiles --- 8.0/Dockerfile.c9s | 2 +- 8.0/Dockerfile.rhel8 | 2 +- 8.0/Dockerfile.rhel9 | 2 +- 8.4/Dockerfile.c10s | 2 +- 8.4/Dockerfile.c9s | 2 +- 8.4/Dockerfile.rhel10 | 1 - 8.4/Dockerfile.rhel9 | 2 +- src/Dockerfile | 7 ++++--- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/8.0/Dockerfile.c9s b/8.0/Dockerfile.c9s index 20307315..0903e2b1 100644 --- a/8.0/Dockerfile.c9s +++ b/8.0/Dockerfile.c9s @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s:c9s" \ maintainer="SoftwareCollections.org " diff --git a/8.0/Dockerfile.rhel8 b/8.0/Dockerfile.rhel8 index b26afbb7..6b8586b4 100644 --- a/8.0/Dockerfile.rhel8 +++ b/8.0/Dockerfile.rhel8 @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel8/mysql-80" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel8/mysql-80" \ maintainer="SoftwareCollections.org " diff --git a/8.0/Dockerfile.rhel9 b/8.0/Dockerfile.rhel9 index 0925ce18..ee0fabe1 100644 --- a/8.0/Dockerfile.rhel9 +++ b/8.0/Dockerfile.rhel9 @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " diff --git a/8.4/Dockerfile.c10s b/8.4/Dockerfile.c10s index 7a3305f9..38af9e67 100644 --- a/8.4/Dockerfile.c10s +++ b/8.4/Dockerfile.c10s @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c10s" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c10s:c10s" \ maintainer="SoftwareCollections.org " diff --git a/8.4/Dockerfile.c9s b/8.4/Dockerfile.c9s index 4f00e122..f6cfb6d3 100644 --- a/8.4/Dockerfile.c9s +++ b/8.4/Dockerfile.c9s @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/${NAME}-${MYSQL_SHORT_VERSION}-c9s:c9s" \ maintainer="SoftwareCollections.org " diff --git a/8.4/Dockerfile.rhel10 b/8.4/Dockerfile.rhel10 index bd564aed..8d233248 100644 --- a/8.4/Dockerfile.rhel10 +++ b/8.4/Dockerfile.rhel10 @@ -31,7 +31,6 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel10/${NAME}-${MYSQL_SHORT_VERSION}" \ - version="${MYSQL_VERSION}" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel10/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " diff --git a/8.4/Dockerfile.rhel9 b/8.4/Dockerfile.rhel9 index 1a691f1b..89a33dd4 100644 --- a/8.4/Dockerfile.rhel9 +++ b/8.4/Dockerfile.rhel9 @@ -31,7 +31,7 @@ LABEL summary="${SUMMARY}" \ io.openshift.tags="database,${NAME},${NAME}${MYSQL_SHORT_VERSION},${NAME}-${MYSQL_SHORT_VERSION}" \ com.redhat.component="${NAME}-${MYSQL_SHORT_VERSION}-container" \ name="rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ - version="${MYSQL_VERSION}" \ + version="1" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel9/${NAME}-${MYSQL_SHORT_VERSION}" \ maintainer="SoftwareCollections.org " diff --git a/src/Dockerfile b/src/Dockerfile index a1d0d277..1588163d 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -29,10 +29,11 @@ LABEL summary="${SUMMARY}" \ io.k8s.display-name="MySQL ${MYSQL_VERSION}" \ io.openshift.expose-services="3306:mysql" \ 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 %}" \ - 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 %}" \ + com.redhat.component="{% if spec.prod != 'fedora' %}${NAME}-${MYSQL_SHORT_VERSION}-container{% else %}${NAME}{% endif %}" \ name="{{ spec.img_name }}" \ - version="${MYSQL_VERSION}" \ -{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ +{% if spec.prod == 'fedora' %} version="${MYSQL_VERSION}" \ +{% elif spec.prod != 'rhel10' %} version="1" \ +{% endif %}{% if spec.license_terms %} com.redhat.license_terms="{{ spec.license_terms }}" \ {% 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 %}" \ maintainer="SoftwareCollections.org "