From 90bd4a1e3e15331b6ecd05f9ac34824f184827be Mon Sep 17 00:00:00 2001 From: Sven Gottwald <2502366+svengo@users.noreply.github.com> Date: Sat, 20 Apr 2019 14:24:53 +0200 Subject: [PATCH] Add Dockerfile.self-contained (#283) * Add Dockerfile using multi-stage build * Rename Dockerfile and use more RUN commands --- Dockerfile.self-contained | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Dockerfile.self-contained diff --git a/Dockerfile.self-contained b/Dockerfile.self-contained new file mode 100644 index 0000000..64d5dc0 --- /dev/null +++ b/Dockerfile.self-contained @@ -0,0 +1,38 @@ +# +# Builder +# + +FROM golang:alpine as builder + +# use version (for example "v0.3.3") or "master" +ARG WATCHTOWER_VERSION=master + +RUN apk add --no-cache \ + alpine-sdk \ + ca-certificates \ + git \ + tzdata + +RUN git clone --branch "${WATCHTOWER_VERSION}" https://github.com/containrrr/watchtower.git + +RUN \ + cd watchtower && \ + \ + GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' . && \ + GO111MODULE=on go test ./... -v + + +# +# watchtower +# + +FROM scratch + +LABEL "com.centurylinklabs.watchtower"="true" + +# copy files from other container +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt +COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo +COPY --from=builder /go/watchtower/watchtower /watchtower + +ENTRYPOINT ["/watchtower"]