Skip to content

Commit

Permalink
Add version 7 to valkey-container
Browse files Browse the repository at this point in the history
Signed-off-by: Petr "Stone" Hracek <[email protected]>
  • Loading branch information
phracek committed Aug 16, 2024
1 parent c3f9ce7 commit a0063ab
Show file tree
Hide file tree
Showing 35 changed files with 1,282 additions and 434 deletions.
Empty file removed 7/.exclude-c8s
Empty file.
Empty file removed 7/.exclude-rhel8
Empty file.
90 changes: 90 additions & 0 deletions 7/Dockerfile.c10s
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
FROM quay.io/sclorg/s2i-core-c10s:c10s

# Valkey image based on Software Collections packages
#
# Volumes:
# * /var/lib/valkey/data - Datastore for Valkey
# Environment:
# * $VALKEY_PASSWORD - Database password

ENV VALKEY_VERSION=7 \
HOME=/var/lib/valkey \
NAME=valkey

ENV SUMMARY="Valkey in-memory data structure store, used as database, cache and message broker" \
DESCRIPTION="Valkey $VALKEY_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, Valkey 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="Valkey $VALKEY_VERSION" \
io.openshift.expose-services="6379:valkey" \
io.openshift.tags="database,valkey,valkey,valkey-$VALKEY_VERSION" \
com.redhat.component="valkey-$VALKEY_VERSION-container" \
name="sclorg/valkey-$VALKEY_VERSION-c10s" \
version="$VALKEY_VERSION" \
com.redhat.license_terms="https://www.redhat.com/en/about/red-hat-end-user-license-agreements#rhel" \
usage="podman run -d --name valkey_database -p 6379:6379 quay.io/sclorg/valkey-$VALKEY_VERSION-c10s" \
maintainer="SoftwareCollections.org <[email protected]>"

EXPOSE 6379

# Get prefix path and path to scripts rather than hard-code them in scripts
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/valkey \
VALKEY_PREFIX=/usr \
VALKEY_CONF=/etc/valkey/valkey.conf \
VALKEY_SOCK=/run/valkey/valkey.sock \
VALKEY_LIB=/var/lib/valkey \
VALKEY_RUN=/run/valkey


# Create user for Valkey 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 Valkey 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 valkey &> /dev/null || groupadd -r valkey &> /dev/null && \
usermod -l valkey -aG valkey -c 'Valkey Server' default &> /dev/null && \
# Install gettext for envsubst command
INSTALL_PKGS="policycoreutils gettext bind valkey" && \
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf -y clean all --enablerepo='*' && \
valkey-server --version | grep -qe "^Server v=$VALKEY_VERSION\." && echo "Found VERSION $VALKEY_VERSION" && \
mkdir -p $VALKEY_LIB/data && chown -R valkey:0 $VALKEY_LIB && \
mkdir -p $VALKEY_RUN && chown -R valkey:0 $VALKEY_RUN && \
chmod -R ug+rwX $VALKEY_RUN && \
chmod -R ug+rwX $VALKEY_LIB && \
[[ "$(id valkey)" == "uid=1001(valkey)"* ]]

# Get prefix path and path to scripts rather than hard-code them in scripts
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/valkey \
VALKEY_PREFIX=/usr \
VALKEY_CONF=/etc/valkey/valkey.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/valkey/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-valkey"]
77 changes: 0 additions & 77 deletions 7/Dockerfile.c8s

This file was deleted.

78 changes: 0 additions & 78 deletions 7/Dockerfile.c9s

This file was deleted.

75 changes: 40 additions & 35 deletions 7/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -1,65 +1,70 @@
FROM quay.io/fedora/s2i-core:38
FROM quay.io/fedora/s2i-core:40

# Redis image based on Software Collections packages
# Valkey image based on Software Collections packages
#
# Volumes:
# * /var/lib/redis/data - Datastore for Redis
# * /var/lib/valkey/data - Datastore for Valkey
# Environment:
# * $REDIS_PASSWORD - Database password
# * $VALKEY_PASSWORD - Database password

ENV NAME=redis \
VERSION=7
ENV VALKEY_VERSION=7 \
HOME=/var/lib/valkey \
NAME=valkey

ENV REDIS_VERSION=$VERSION \
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. \
ENV SUMMARY="Valkey in-memory data structure store, used as database, cache and message broker" \
DESCRIPTION="Valkey $VALKEY_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 \
performance, Valkey 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="$SUMMARY" \
io.k8s.display-name="Redis 7" \
io.openshift.expose-services="6379:redis" \
io.openshift.tags="database,redis,redis7" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="Valkey $VALKEY_VERSION" \
io.openshift.expose-services="6379:valkey" \
io.openshift.tags="database,valkey,valkey$VALKEY_VERSION,valkey-$VALKEY_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-$VALKEY_VERSION" \
version="$VALKEY_VERSION" \
usage="podman run -d --name valkey_database -p 6379:6379 quay.io/fedora/$NAME-$VALKEY_VERSION" \
maintainer="SoftwareCollections.org <[email protected]>"

EXPOSE 6379

# Create user for redis that has known UID
# Get prefix path and path to scripts rather than hard-code them in scripts
ENV CONTAINER_SCRIPTS_PATH=/usr/share/container-scripts/valkey \
VALKEY_PREFIX=/usr \
VALKEY_CONF=/etc/valkey/valkey.conf \
VALKEY_SOCK=/run/valkey/valkey.sock \
VALKEY_LIB=/var/lib/valkey \
VALKEY_RUN=/run/valkey

# Create user for valkey 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
# This image must forever use UID 1001 for valkey 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 && \
RUN getent group valkey &> /dev/null || groupadd -r valkey &> /dev/null && \
usermod -l valkey -aG valkey -c 'Server' default &> /dev/null && \
# Install gettext for envsubst command
dnf install -y yum-utils gettext policycoreutils && \
INSTALL_PKGS="redis" && \
dnf install -y dnf-utils gettext policycoreutils && \
INSTALL_PKGS="valkey" && \
dnf install -y --setopt=tsflags=nodocs --nogpgcheck $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
dnf clean all && \
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)"* ]]
dnf -y clean all --enablerepo='*' && \
valkey-server --version | grep -qe "^Server v=$VALKEY_VERSION\." && echo "Found VERSION $VALKEY_VERSION" && \
mkdir -p $VALKEY_LIB/data && chown -R valkey:0 $VALKEY_LIB && \
mkdir -p $VALKEY_RUN && chown -R valkey:0 $VALKEY_RUN && \
chmod -R ug+rwX $VALKEY_RUN && \
chmod -R ug+rwX $VALKEY_LIB && \
[[ "$(id valkey)" == "uid=1001(valkey)"* ]]

# 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 /

Expand All @@ -68,7 +73,7 @@ COPY root /
# script.
RUN /usr/libexec/container-setup

VOLUME ["/var/lib/redis/data"]
VOLUME ["/var/lib/valkey/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,
Expand All @@ -77,4 +82,4 @@ VOLUME ["/var/lib/redis/data"]
USER 1001

ENTRYPOINT ["container-entrypoint"]
CMD ["run-redis"]
CMD ["run-valkey"]
Loading

0 comments on commit a0063ab

Please sign in to comment.