mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-16 15:10:12 +01:00
Change Dockerfile to be compatible with automatic builds
This commit is contained in:
parent
203f24b35c
commit
a2ba221ad3
3 changed files with 35 additions and 47 deletions
10
.dockerignore
Normal file
10
.dockerignore
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
Dockerfile
|
||||
.dockerignore
|
||||
.git
|
||||
.gitignore
|
||||
watchtower
|
||||
vendor
|
||||
.glide
|
||||
dist
|
||||
.idea
|
||||
.DS_Store
|
||||
34
Dockerfile
34
Dockerfile
|
|
@ -1,18 +1,34 @@
|
|||
FROM alpine:3.9 as alpine
|
||||
#
|
||||
# Builder
|
||||
#
|
||||
|
||||
FROM golang:alpine as builder
|
||||
|
||||
RUN apk add --no-cache \
|
||||
alpine-sdk \
|
||||
ca-certificates \
|
||||
git \
|
||||
tzdata
|
||||
|
||||
WORKDIR /usr/local/src
|
||||
COPY . .
|
||||
|
||||
RUN \
|
||||
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 --from=alpine \
|
||||
/etc/ssl/certs/ca-certificates.crt \
|
||||
/etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=alpine \
|
||||
/usr/share/zoneinfo \
|
||||
/usr/share/zoneinfo
|
||||
# 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 /usr/local/src/watchtower /watchtower
|
||||
|
||||
COPY watchtower /
|
||||
ENTRYPOINT ["/watchtower"]
|
||||
ENTRYPOINT ["/watchtower"]
|
||||
|
|
|
|||
|
|
@ -1,38 +0,0 @@
|
|||
#
|
||||
# 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"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue