Skip to content

Commit

Permalink
Parameterise repository reference in Dockerfile
Browse files Browse the repository at this point in the history
This commit parameterises the KeyDB source code repository URL and
branch values in the Dockerfile for improved reusability.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
  • Loading branch information
stephanosio committed Feb 23, 2024
1 parent 2ad14de commit 7b98920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)"; \
Expand All @@ -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; \
Expand Down
5 changes: 3 additions & 2 deletions pkg/docker/Dockerfile_Alpine
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand All @@ -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; \
Expand Down

0 comments on commit 7b98920

Please sign in to comment.