-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
name: Build Watchtower image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'watchtower/**' | ||
- '!watchtower/README.md' | ||
- '.github/workflows/build-watchtower.yml' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
strategy: | ||
matrix: | ||
version: ['1.7.1'] | ||
steps: | ||
- name: Check-out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push image to registry | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64 | ||
context: ./watchtower | ||
file: ./watchtower/Dockerfile | ||
push: true | ||
build-args: | | ||
PG_RELEASE=${{ matrix.version }} | ||
tags: | | ||
ghcr.io/f-bn/watchtower:${{ matrix.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# --- Build stage --- | ||
FROM docker.io/golang:1.20 AS build | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG VERSION=1.7.1 | ||
|
||
ENV GOOS=${TARGETOS} | ||
ENV GOARCH=${TARGETARCH} | ||
ENV GO111MODULE=on | ||
ENV CGO_ENABLED=0 | ||
|
||
WORKDIR /build | ||
|
||
RUN git clone --single-branch --branch v${VERSION} https://github.com/containrrr/watchtower.git /build | ||
RUN set -ex ; \ | ||
go build -a -ldflags "-extldflags '-static' -X github.com/containrrr/watchtower/internal/meta.Version=$(git describe --tags)" -o /build/bin/watchtower ; \ | ||
go test ./... -v | ||
|
||
# --- Final stage --- | ||
FROM cgr.dev/chainguard/wolfi-base:latest | ||
|
||
COPY --from=build --chmod=755 /build/bin/watchtower /usr/bin/watchtower | ||
|
||
EXPOSE 8080/tcp | ||
|
||
HEALTHCHECK CMD [ "/usr/bin/watchtower", "--health-check"] | ||
|
||
ENTRYPOINT [ "/usr/bin/watchtower" ] | ||
|
||
LABEL \ | ||
org.opencontainers.image.title="watchtower" \ | ||
org.opencontainers.image.source="https://github.com/f-bn/containers-images/watchtower" \ | ||
org.opencontainers.image.description="A process for automating Docker container base image updates" \ | ||
org.opencontainers.image.licenses="Apache-2.0" \ | ||
org.opencontainers.image.authors="Florian Bobin <[email protected]>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## General informations | ||
|
||
Custom Watchtower image builded from sources. | ||
|
||
Built with Go 1.20. | ||
|
||
## Watchtower configuration | ||
|
||
Watchtower is able to read configuration from environment variables or flags, this is still valid for this custom image. | ||
|
||
More informations about Watchtower configuration [here](https://containrrr.dev/watchtower/). |