-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1091 from uselagoon/valkey
build: initial valkey-8 image build
- Loading branch information
Showing
8 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG IMAGE_REPO | ||
FROM ${IMAGE_REPO:-lagoon}/commons AS commons | ||
FROM valkey/valkey:8.0.0-alpine3.20 | ||
|
||
|
||
ARG LAGOON_VERSION | ||
ENV LAGOON_VERSION=$LAGOON_VERSION | ||
LABEL org.opencontainers.image.authors="The Lagoon Authors" | ||
LABEL org.opencontainers.image.source="https://github.com/uselagoon/lagoon-images/blob/main/images/valkey/8.Dockerfile" | ||
LABEL org.opencontainers.image.url="https://github.com/uselagoon/lagoon-images" | ||
LABEL org.opencontainers.image.version="${LAGOON_VERSION}" | ||
LABEL org.opencontainers.image.description="Valkey 8 image optimised for running in Lagoon in production and locally" | ||
LABEL org.opencontainers.image.title="uselagoon/valkey-8" | ||
LABEL org.opencontainers.image.base.name="docker.io/valkey/valkey:8-alpine" | ||
|
||
ENV LAGOON=valkey | ||
|
||
ENV FLAVOR=ephemeral | ||
|
||
# Copy commons files | ||
COPY --from=commons /lagoon /lagoon | ||
COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/wait-for /bin/ | ||
COPY --from=commons /sbin/tini /sbin/ | ||
COPY --from=commons /home /home | ||
|
||
RUN fix-permissions /etc/passwd \ | ||
&& mkdir -p /home \ | ||
&& mkdir -p /etc/valkey | ||
|
||
ENV TMPDIR=/tmp \ | ||
TMP=/tmp \ | ||
HOME=/home \ | ||
# When Bash is invoked via `sh` it behaves like the old Bourne Shell and sources a file that is given in `ENV` | ||
ENV=/home/.bashrc \ | ||
# When Bash is invoked as non-interactive (like `bash -c command`) it sources a file that is given in `BASH_ENV` | ||
BASH_ENV=/home/.bashrc | ||
|
||
COPY conf /etc/valkey/ | ||
COPY docker-entrypoint /lagoon/entrypoints/70-valkey-entrypoint | ||
|
||
RUN fix-permissions /etc/valkey \ | ||
fix-permissions /data | ||
|
||
ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"] | ||
CMD ["valkey-server", "/etc/valkey/valkey.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# this disabled the persistent cache | ||
save "" | ||
appendonly no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
save 300 1 | ||
save 60 100 | ||
|
||
appendonly yes | ||
appendfsync everysec | ||
|
||
auto-aof-rewrite-percentage 100 | ||
auto-aof-rewrite-min-size 64mb | ||
|
||
# RDB files created with checksum disabled have a checksum of zero that will | ||
# tell the loading code to skip the check. | ||
rdbchecksum yes | ||
|
||
# The filename where to dump the DB | ||
dbfilename valkey.rdb | ||
|
||
dir /data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Valkey configuration file for non-persistent cache | ||
# see https://github.com/valkey-io/valkey/blob/unstable/valkey.conf for all possible configs. | ||
|
||
loglevel ${LOGLEVEL:-notice} | ||
databases ${DATABASES:-1} | ||
|
||
maxmemory ${MAXMEMORY:-400mb} | ||
maxmemory-policy ${MAXMEMORYPOLICY:-allkeys-lru} | ||
|
||
# allow other hosts to connect to us | ||
protected-mode no | ||
bind 0.0.0.0 | ||
|
||
${REQUIREPASS_CONF:-} | ||
|
||
include /etc/valkey/${FLAVOR:-ephemeral}.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
if [[ -n "${REDIS_PASSWORD}" ]]; then | ||
echo "You should not use the REDIS_PASSWORD environment variable, use VALKEY_PASSWORD instead" | ||
export VALKEY_PASSWORD=${REDIS_PASSWORD} | ||
fi | ||
|
||
if [[ -n "${VALKEY_PASSWORD}" ]]; then | ||
export REQUIREPASS_CONF="# Enable basic/simple authentication | ||
# Warning: since Valkey is pretty fast an outside user can try up to | ||
# 150k passwords per second against a good box. This means that you should | ||
# use a very strong password otherwise it will be very easy to break. | ||
requirepass ${VALKEY_PASSWORD}" | ||
fi | ||
|
||
# Check if VALKEY_FLAVOR or FLAVOR is set and has the value "persistent" | ||
if [ "${VALKEY_FLAVOR}" = "persistent" ] || [ "${FLAVOR}" = "persistent" ]; then | ||
FLAVOR="persistent" | ||
else | ||
FLAVOR="ephemeral" | ||
fi | ||
echo "FLAVOR is set to: $FLAVOR" | ||
|
||
ep /etc/valkey/* | ||
|
||
exec "$@" |