From fe331ba133dadb339b0d1eb73848fe4dad65ca94 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 29 Jul 2024 09:19:20 +0200 Subject: [PATCH 1/4] Copy Dockerfile.c10s based on Dockerfile.c9s Signed-off-by: Petr "Stone" Hracek --- 7/Dockerfile.c10s | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 7/Dockerfile.c10s diff --git a/7/Dockerfile.c10s b/7/Dockerfile.c10s new file mode 100644 index 0000000..9b157fc --- /dev/null +++ b/7/Dockerfile.c10s @@ -0,0 +1,78 @@ +FROM quay.io/sclorg/s2i-core-c9s:c9s + +# Redis image based on Software Collections packages +# +# Volumes: +# * /var/lib/redis/data - Datastore for Redis +# Environment: +# * $REDIS_PASSWORD - Database password + +ENV REDIS_VERSION=7 \ + HOME=/var/lib/redis + +ENV SUMMARY="Redis in-memory data structure store, used as database, cache and message broker" \ + DESCRIPTION="Redis $REDIS_VERSION available as container, is an advanced key-value store. \ +It is often referred to as a data structure server since keys can contain strings, hashes, lists, \ +sets and sorted sets. You can run atomic operations on these types, like appending to a string; \ +incrementing the value in a hash; pushing to a list; computing set intersection, union and difference; \ +or getting the member with highest ranking in a sorted set. In order to achieve its outstanding \ +performance, Redis works with an in-memory dataset. Depending on your use case, you can persist \ +it either by dumping the dataset to disk every once in a while, or by appending each command to a log." + +LABEL summary="$SUMMARY" \ + description="$DESCRIPTION" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Redis $REDIS_VERSION" \ + io.openshift.expose-services="6379:redis" \ + io.openshift.tags="database,redis,redis$REDIS_VERSION,redis-$REDIS_VERSION" \ + com.redhat.component="redis-$REDIS_VERSION-container" \ + name="sclorg/redis-$REDIS_VERSION-c9s" \ + version="1" \ + com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ + usage="podman run -d --name redis_database -p 6379:6379 quay.io/sclorg/redis-$REDIS_VERSION-c9s" \ + maintainer="SoftwareCollections.org " + +EXPOSE 6379 + +# Create user for redis that has known UID +# We need to do this before installing the RPMs which would create user with random UID +# The UID is the one used by the default user from the parent layer (1001), +# and since the user exists already, do not create a new one, but only rename +# the existing +# This image must forever use UID 1001 for redis user so our volumes are +# safe in the future. This should *never* change, the last test is there +# to make sure of that. +RUN getent group redis &> /dev/null || groupadd -r redis &> /dev/null && \ + usermod -l redis -aG redis -c 'Redis Server' default &> /dev/null && \ +# Install gettext for envsubst command + yum -y module enable redis:$REDIS_VERSION && \ + INSTALL_PKGS="policycoreutils redis" && \ + yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + rpm -V $INSTALL_PKGS && \ + yum -y clean all --enablerepo='*' && \ + redis-server --version | grep -qe "^Redis server v=$REDIS_VERSION\." && echo "Found VERSION $REDIS_VERSION" && \ + mkdir -p /var/lib/redis/data && chown -R redis.0 /var/lib/redis && \ + [[ "$(id redis)" == "uid=1001(redis)"* ]] + +# Get prefix path and path to scripts rather than hard-code them in scripts +ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/redis \ + REDIS_PREFIX=/usr \ + REDIS_CONF=/etc/redis/redis.conf + +COPY root / + +# this is needed due to issues with squash +# when this directory gets rm'd by the container-setup +# script. +RUN /usr/libexec/container-setup + +VOLUME ["/var/lib/redis/data"] + +# Using a numeric value because of a comment in [1]: +# If your S2I image does not include a USER declaration with a numeric user, +# your builds will fail by default. +# [1] https://docs.openshift.com/container-platform/4.4/openshift_images/create-images.html#images-create-guide-openshift_create-images +USER 1001 + +ENTRYPOINT ["container-entrypoint"] +CMD ["run-redis"] From 48bc4e7646a01cf79ebd9d94b24726ce7b5a93e5 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 29 Jul 2024 09:29:47 +0200 Subject: [PATCH 2/4] Modify Dockerfile.c10s for using C10S. Small rewrite in Dockerfile.fedora Signed-off-by: Petr "Stone" Hracek --- 7/Dockerfile.c10s | 15 +++++++-------- 7/Dockerfile.fedora | 19 ++++++++----------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/7/Dockerfile.c10s b/7/Dockerfile.c10s index 9b157fc..eeb3de5 100644 --- a/7/Dockerfile.c10s +++ b/7/Dockerfile.c10s @@ -1,4 +1,4 @@ -FROM quay.io/sclorg/s2i-core-c9s:c9s +FROM quay.io/sclorg/s2i-core-c10s:c10s # Redis image based on Software Collections packages # @@ -26,10 +26,10 @@ LABEL summary="$SUMMARY" \ io.openshift.expose-services="6379:redis" \ io.openshift.tags="database,redis,redis$REDIS_VERSION,redis-$REDIS_VERSION" \ com.redhat.component="redis-$REDIS_VERSION-container" \ - name="sclorg/redis-$REDIS_VERSION-c9s" \ - version="1" \ + name="sclorg/redis-$REDIS_VERSION-c10s" \ + version="$REDIS_VERSION" \ com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \ - usage="podman run -d --name redis_database -p 6379:6379 quay.io/sclorg/redis-$REDIS_VERSION-c9s" \ + usage="podman run -d --name redis_database -p 6379:6379 quay.io/sclorg/redis-$REDIS_VERSION-c10s" \ maintainer="SoftwareCollections.org " EXPOSE 6379 @@ -45,11 +45,10 @@ EXPOSE 6379 RUN getent group redis &> /dev/null || groupadd -r redis &> /dev/null && \ usermod -l redis -aG redis -c 'Redis Server' default &> /dev/null && \ # Install gettext for envsubst command - yum -y module enable redis:$REDIS_VERSION && \ - INSTALL_PKGS="policycoreutils redis" && \ - yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ + INSTALL_PKGS="policycoreutils gettext redis" && \ + dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - yum -y clean all --enablerepo='*' && \ + dnf -y clean all --enablerepo='*' && \ redis-server --version | grep -qe "^Redis server v=$REDIS_VERSION\." && echo "Found VERSION $REDIS_VERSION" && \ mkdir -p /var/lib/redis/data && chown -R redis.0 /var/lib/redis && \ [[ "$(id redis)" == "uid=1001(redis)"* ]] diff --git a/7/Dockerfile.fedora b/7/Dockerfile.fedora index 7d10d0c..100a3db 100644 --- a/7/Dockerfile.fedora +++ b/7/Dockerfile.fedora @@ -7,10 +7,7 @@ FROM quay.io/fedora/s2i-core:38 # Environment: # * $REDIS_PASSWORD - Database password -ENV NAME=redis \ - VERSION=7 - -ENV REDIS_VERSION=$VERSION \ +ENV REDIS_VERSION=7 \ HOME=/var/lib/redis ENV SUMMARY="Redis in-memory data structure store, used as database, cache and message broker" \ @@ -24,14 +21,14 @@ it either by dumping the dataset to disk every once in a while, or by appending LABEL summary="$SUMMARY" \ description="$DESCRIPTION" \ - io.k8s.description="$SUMMARY" \ - io.k8s.display-name="Redis 7" \ + io.k8s.description="$DESCRIPTION" \ + io.k8s.display-name="Redis $REDIS_VERSION" \ io.openshift.expose-services="6379:redis" \ - io.openshift.tags="database,redis,redis7" \ + io.openshift.tags="database,redis,redis$REDIS_VERSION,redis-$REDIS_VERSION" \ com.redhat.component="$NAME" \ - name="fedora/$NAME-$VERSION" \ - version="$VERSION" \ - usage="docker run -d --name redis_database -p 6379:6379 quay.io/fedora/$NAME-$VERSION" \ + name="fedora/$NAME-$REDIS_VERSION" \ + version="$REDIS_VERSION" \ + usage="podman run -d --name redis_database -p 6379:6379 quay.io/fedora/$NAME-$REDIS_VERSION" \ maintainer="SoftwareCollections.org " EXPOSE 6379 @@ -51,7 +48,7 @@ RUN getent group redis &> /dev/null || groupadd -r redis &> /dev/null && \ INSTALL_PKGS="redis" && \ dnf install -y --setopt=tsflags=nodocs --nogpgcheck $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ - dnf clean all && \ + dnf -y clean all --enablerepo='*' && \ redis-server --version | grep -qe "^Redis server v=$REDIS_VERSION\." && echo "Found VERSION $REDIS_VERSION" && \ mkdir -p /var/lib/redis/data && chown -R redis.0 /var/lib/redis && \ [[ "$(id redis)" == "uid=1001(redis)"* ]] From be35db6269731f1e395697dff609784a2b1c4017 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 29 Jul 2024 09:34:55 +0200 Subject: [PATCH 3/4] Update README's Signed-off-by: Petr "Stone" Hracek --- 7/root/usr/share/container-scripts/redis/README.md | 4 ++-- README.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/7/root/usr/share/container-scripts/redis/README.md b/7/root/usr/share/container-scripts/redis/README.md index 981b1e2..3a79beb 100644 --- a/7/root/usr/share/container-scripts/redis/README.md +++ b/7/root/usr/share/container-scripts/redis/README.md @@ -84,5 +84,5 @@ See also Dockerfile and other sources for this container image are available on https://github.com/sclorg/redis-container. In that repository you also can find another versions of Python environment Dockerfiles. -Dockerfile for RHEL8 it's `Dockerfile.rhel8`, for RHEL9 it's `Dockerfile.rhel9`, -for CentOS Stream 9 it's `Dockerfile.c9s` and the Fedora Dockerfile is called Dockerfile.fedora. +Dockerfile for RHEL8 it's `Dockerfile.rhel8`, Dockerfile for RHEL9 it's `Dockerfile.rhel9`, +Dockerfile for CentOS Stream 9 it's `Dockerfile.c9s`, Dockerfile for CentOS Stream 10 it's `Dockerfile.c10s` and the Fedora Dockerfile is called Dockerfile.fedora. diff --git a/README.md b/README.md index ceeff66..2158057 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ Redis container image Images available on Quay are: * CentOS Stream 9 [redis-6](https://quay.io/repository/sclorg/redis-6-c9s) +* CentOS Stream 7 [redis-7](https://quay.io/repository/sclorg/redis-7-c9s) * Fedora [redis-6](https://quay.io/repository/fedora/redis-6) * Fedora [redis-7](https://quay.io/repository/fedora/redis-7) @@ -29,6 +30,7 @@ RHEL versions currently supported are: CentOS versions currently supported are: * CentOS Stream 9 +* CentOS Stream 10 Installation From 1dabeffd493ab49166f8f3f9efd3b649c3b29470 Mon Sep 17 00:00:00 2001 From: "Petr \"Stone\" Hracek" Date: Mon, 29 Jul 2024 09:35:04 +0200 Subject: [PATCH 4/4] Update build-and-push action. Signed-off-by: Petr "Stone" Hracek --- .github/workflows/build-and-push.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 1092c07..088b237 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -38,6 +38,14 @@ jobs: quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" docker_context: "7" + - dockerfile: "7/Dockerfile.c10s" + registry_namespace: "sclorg" + tag: "c10s" + image_name: "redis-7-c10s" + quayio_username: "QUAY_IMAGE_SCLORG_BUILDER_USERNAME" + quayio_token: "QUAY_IMAGE_SCLORG_BUILDER_TOKEN" + docker_context: "10" + steps: - name: Build and push to quay.io registry uses: sclorg/build-and-push-action@v4