Skip to content

Instantly share code, notes, and snippets.

@svengo
Created April 17, 2019 13:46
Show Gist options
  • Save svengo/feb38f545ebbb63a689e1e937b30f2b7 to your computer and use it in GitHub Desktop.
Save svengo/feb38f545ebbb63a689e1e937b30f2b7 to your computer and use it in GitHub Desktop.
Dockerfile for containrrr/watchtower
#
# Builder
#
FROM golang:alpine as builder
#ARG WATCHTOWER_VERSION=v0.3.3
ARG WATCHTOWER_VERSION=master
RUN \
apk add --no-cache \
alpine-sdk \
ca-certificates \
git \
tzdata && \
\
mkdir --parents $GOPATH/src/github.com/containrrr && \
cd $GOPATH/src/github.com/containrrr && \
git clone --branch "${WATCHTOWER_VERSION}" https://github.com/containrrr/watchtower.git && \
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/src/github.com/containrrr/watchtower/watchtower /watchtower
ENTRYPOINT ["/watchtower"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment