From 092ee0218f03e939c0c0a9cfb2b2058627cedc8e Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 6 Mar 2019 18:43:52 -0800 Subject: [PATCH] dockerize image --- Dockerfile | 17 +++++++++++++++++ Makefile | 17 +++++++++++++++++ start | 7 +++++++ 3 files changed, 41 insertions(+) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100755 start diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9780cad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM golang:1.14 + +ADD . /tmp/code + +RUN cd /tmp/code && make + +FROM ubuntu:eoan + +COPY --from=0 /tmp/code/redis-sentinel-proxy /usr/local/bin/redis-sentinel-proxy + +ADD start /start + +RUN chmod +x /start + +USER nobody + +ENTRYPOINT ["/start"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..29ddc5b --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +TAGNAME := dockermirror:5000/dpedu/redisproxy +LOCALNAME := redisproxy + +.DEFAULT_GOAL: redis-sentinel-proxy + +redis-sentinel-proxy: + go build -o $@ + +image: + rm -f redis-sentinel-proxy + docker build -t $(LOCALNAME) . + +tag: image + docker tag $(LOCALNAME) $(TAGNAME) + +push: tag + docker push $(TAGNAME) diff --git a/start b/start new file mode 100755 index 0000000..c18d834 --- /dev/null +++ b/start @@ -0,0 +1,7 @@ +#!/bin/sh -ex + +LOCALPORT=${LOCALPORT:-:9999} +SENTINEL=${SENTINEL:-:26739} +MASTERNAME=${MASTERNAME:-""} + +exec /usr/local/bin/redis-sentinel-proxy -listen $LOCALPORT -sentinel $SENTINEL -master $MASTERNAME