mirror of
https://github.com/containrrr/watchtower.git
synced 2025-03-03 15:32:37 +02:00
Merge pull request #431 from victorcmoura/feature/430
Adds self-contained dev Dockerfile
This commit is contained in:
commit
e6c8b5e0d4
@ -25,4 +25,14 @@ go build # compiles and packages an executable bin
|
||||
go test ./... -v # runs tests with verbose output
|
||||
./watchtower # runs the application (outside of a container)
|
||||
```
|
||||
|
||||
If you dont have it enabled, you'll either have to prefix each command with `GO111MODULE=on` or run `export GO111MODULE=on` before running the commands. [You can read more about modules here.](https://github.com/golang/go/wiki/Modules)
|
||||
|
||||
To build a Watchtower image of your own, use the self-contained Dockerfiles. As the main Dockerfile, they can be found in `dockerfiles/`:
|
||||
- `dockerfiles/Dockerfile.dev-self-contained` will build an image based on your current local Watchtower files.
|
||||
- `dockerfiles/Dockerfile.self-contained` will build an image based on current Watchtower's repository on GitHub.
|
||||
|
||||
e.g.:
|
||||
```bash
|
||||
sudo docker build . -f dockerfiles/Dockerfile.dev-self-contained -t containrrr/watchtower # to build an image from local files
|
||||
```
|
38
dockerfiles/Dockerfile.dev-self-contained
Normal file
38
dockerfiles/Dockerfile.dev-self-contained
Normal file
@ -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
|
||||
|
||||
COPY . /watchtower
|
||||
|
||||
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 /watchtower/watchtower /watchtower
|
||||
|
||||
ENTRYPOINT ["/watchtower"]
|
@ -29,7 +29,7 @@ dockers:
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
goarm: ''
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: dockerfiles/Dockerfile
|
||||
image_templates:
|
||||
- containrrr/watchtower:amd64-{{ .Version }}
|
||||
- containrrr/watchtower:amd64-latest
|
||||
@ -39,7 +39,7 @@ dockers:
|
||||
goos: linux
|
||||
goarch: 386
|
||||
goarm: ''
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: dockerfiles/Dockerfile
|
||||
image_templates:
|
||||
- containrrr/watchtower:i386-{{ .Version }}
|
||||
- containrrr/watchtower:i386-latest
|
||||
@ -49,7 +49,7 @@ dockers:
|
||||
goos: linux
|
||||
goarch: arm
|
||||
goarm: 6
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: dockerfiles/Dockerfile
|
||||
image_templates:
|
||||
- containrrr/watchtower:armhf-{{ .Version }}
|
||||
- containrrr/watchtower:armhf-latest
|
||||
@ -59,7 +59,7 @@ dockers:
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
goarm: ''
|
||||
dockerfile: Dockerfile
|
||||
dockerfile: dockerfiles/Dockerfile
|
||||
image_templates:
|
||||
- containrrr/watchtower:arm64v8-{{ .Version }}
|
||||
- containrrr/watchtower:arm64v8-latest
|
||||
|
Loading…
x
Reference in New Issue
Block a user