From c5c7245dbe050a6ffb1aaf9a112bc909906f1a39 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 4 Mar 2020 09:14:16 -0800 Subject: [PATCH 1/2] Add Dockerfile --- Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..043f653 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM alpine:3.11 as build + +RUN apk add --no-cache gcc musl-dev linux-headers openssl-dev make + +RUN addgroup -S app && adduser -S -G app app +RUN chown -R app:app /opt +RUN chown -R app:app /usr/local + +# There is a bug in CMake where we cannot build from the root top folder +# So we build from /opt +COPY --chown=app:app . /opt +WORKDIR /opt + +USER app +RUN [ "make", "install" ] + +FROM alpine:3.11 as runtime + +# It is quite helpful to have the redis-cli available +# on the proxy to do basic sanity testing +RUN apk add --no-cache redis + +RUN addgroup -S app && adduser -S -G app app +COPY --chown=app:app --from=build /usr/local/bin/redis-cluster-proxy /usr/local/bin/redis-cluster-proxy +RUN chmod +x /usr/local/bin/redis-cluster-proxy +RUN ldd /usr/local/bin/redis-cluster-proxy + +# Copy source code for gcc +COPY --chown=app:app --from=build /opt /opt + +# Now run in usermode +USER app +WORKDIR /home/app + +ENTRYPOINT ["/usr/local/bin/redis-cluster-proxy"] +EXPOSE 7777 +CMD ["redis-cluster-proxy"] From b710f5edcfa20edd4b6bb98b4a5bc851c118997e Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Wed, 4 Mar 2020 09:26:32 -0800 Subject: [PATCH 2/2] add curl --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 043f653..54f1dc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,9 @@ FROM alpine:3.11 as runtime # It is quite helpful to have the redis-cli available # on the proxy to do basic sanity testing -RUN apk add --no-cache redis +# curl can be used to fetch redis-cluster endpoints +# configuration with the kubernete HTTP apis +RUN apk add --no-cache redis curl ca-certificates RUN addgroup -S app && adduser -S -G app app COPY --chown=app:app --from=build /usr/local/bin/redis-cluster-proxy /usr/local/bin/redis-cluster-proxy