Skip to content

Commit

Permalink
feat(watchtower): add image
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bn committed Apr 13, 2024
1 parent 2193b79 commit 7597241
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build-watchtower.yml
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 }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This repository contains my personal custom OCI containers images.
- [navidrome](./navidrome/)
- [pgbouncer](./pgbouncer/)
- [postgresql](./postgresql/)
- [watchtower](./watchtower/)

#### How to pull the images ?

Expand All @@ -25,4 +26,5 @@ docker pull ghcr.io/f-bn/<image>:<tag>
- Navidrome: https://www.navidrome.org/
- PostgreSQL: https://www.postgresql.org/
- pgbouncer: https://www.pgbouncer.org/
- Watchtower: https://containrrr.dev/watchtower/
- WolfiOS: https://github.com/wolfi-dev
36 changes: 36 additions & 0 deletions watchtower/Dockerfile
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]>"
11 changes: 11 additions & 0 deletions watchtower/README.md
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/).

0 comments on commit 7597241

Please sign in to comment.