From 7b98920b4e2b51f703ab82e0ecbf28457e4a3090 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Fri, 23 Feb 2024 13:34:25 +0900 Subject: [PATCH] Parameterise repository reference in Dockerfile This commit parameterises the KeyDB source code repository URL and branch values in the Dockerfile for improved reusability. Signed-off-by: Stephanos Ioannidis --- pkg/docker/Dockerfile | 5 +++-- pkg/docker/Dockerfile_Alpine | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/docker/Dockerfile b/pkg/docker/Dockerfile index d1910adad..db4b5afcb 100644 --- a/pkg/docker/Dockerfile +++ b/pkg/docker/Dockerfile @@ -23,7 +23,8 @@ RUN set -eux; \ gosu --version; \ gosu nobody true # build KeyDB -ARG BRANCH +ARG REPO=https://github.com/Snapchat/KeyDB.git +ARG BRANCH=main RUN set -eux; \ \ savedAptMark="$(apt-mark showmanual)"; \ @@ -47,7 +48,7 @@ RUN set -eux; \ libsnappy-dev \ libssl-dev \ git; \ - cd /tmp && git clone --branch $BRANCH https://github.com/Snapchat/KeyDB.git --recursive; \ + cd /tmp && git clone --branch $BRANCH $REPO --recursive; \ cd /tmp/KeyDB; \ # disable protected mode as it relates to docker grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' ./src/config.cpp; \ diff --git a/pkg/docker/Dockerfile_Alpine b/pkg/docker/Dockerfile_Alpine index 2787eda0b..00a5e1f66 100644 --- a/pkg/docker/Dockerfile_Alpine +++ b/pkg/docker/Dockerfile_Alpine @@ -2,7 +2,8 @@ FROM alpine:3.18 # add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added RUN addgroup -S -g 1000 keydb && adduser -S -G keydb -u 999 keydb RUN mkdir -p /etc/keydb -ARG BRANCH +ARG REPO=https://github.com/Snapchat/KeyDB.git +ARG BRANCH=main RUN set -eux; \ \ apk add --no-cache su-exec tini; \ @@ -26,7 +27,7 @@ RUN set -eux; \ lz4-dev \ snappy-dev \ ; \ - cd /tmp && git clone --branch $BRANCH https://github.com/Snapchat/KeyDB.git --recursive; \ + cd /tmp && git clone --branch $BRANCH $REPO --recursive; \ cd /tmp/KeyDB; \ # disable protected mode as it relates to docker grep -E '^ *createBoolConfig[(]"protected-mode",.*, *1 *,.*[)],$' ./src/config.cpp; \