Skip to content

Commit

Permalink
feat(traefik): add initial image
Browse files Browse the repository at this point in the history
  • Loading branch information
f-bn committed Feb 4, 2025
1 parent 46c875d commit a95bce3
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-traefik.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Build Traefik image
on:
push:
branches:
- main
paths:
- 'traefik/**'
- '!traefik/README.md'
- '.github/workflows/build-traefik.yml'
workflow_dispatch:
schedule:
- cron: '35 4 * * 6' # Every Saturday at 04:35am
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
version: ['3.3.3']
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: ./traefik
file: ./traefik/Dockerfile
push: true
build-args: |
VERSION=${{ matrix.version }}
tags: |
ghcr.io/f-bn/traefik:${{ matrix.version }}
ghcr.io/f-bn/traefik:latest
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This repository contains my personal custom OCI containers images.
- [navidrome](./navidrome/)
- [pgbouncer](./pgbouncer/)
- [postgresql](./postgresql/)
- [traefik](./traefik/)
- [valkey](./valkey/)
- [watchtower](./watchtower/)

Expand All @@ -37,6 +38,7 @@ docker pull ghcr.io/f-bn/<image>:<tag>
- Navidrome: https://www.navidrome.org/
- PostgreSQL: https://www.postgresql.org/
- pgbouncer: https://www.pgbouncer.org/
- Traefik: https://traefik.io/
- Valkey: https://valkey.io/
- Watchtower: https://containrrr.dev/watchtower/
- WolfiOS: https://github.com/wolfi-dev
64 changes: 64 additions & 0 deletions traefik/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# --- Build stage ---
FROM docker.io/node:22.13-bookworm-slim AS build-webui

ARG TARGETOS
ARG TARGETARCH
ARG VERSION="3.3.3"

ADD https://github.com/traefik/traefik.git#v${VERSION} /build

WORKDIR /build/webui

RUN set -ex ; \
yarn install ; \
yarn build

# --- Build stage ---
FROM docker.io/golang:1.23.5 AS build-binary

ARG TARGETOS
ARG TARGETARCH
ARG VERSION="3.3.3"
ARG CODENAME="saint-nectaire"

ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
ENV CGO_ENABLED=0
ENV GOGC="off"

COPY --from=build-webui /build /build

WORKDIR /build

RUN set -ex ; \
mkdir -p /build/dist ; \
go build -ldflags "-s -w \
-X github.com/traefik/traefik/v3/pkg/version.Version=${VERSION} \
-X github.com/traefik/traefik/v3/pkg/version.BuildDate=$(date -u '+%Y-%m-%d_%I:%M:%S%p') \
-X github.com/traefik/traefik/v3/pkg/version.Codename=${CODENAME}" \
-installsuffix nocgo -o "./dist/traefik" ./cmd/traefik

# --- Final stage ---
FROM cgr.dev/chainguard/wolfi-base:latest

COPY --from=build-binary --chown=0:0 --chmod=0755 \
/build/dist/traefik /usr/bin/traefik

RUN set -ex ; \
mkdir -p /etc/traefik ; \
chown nonroot:nonroot /etc/traefik

USER nonroot

EXPOSE 80/tcp 443/tcp

WORKDIR /etc/traefik

ENTRYPOINT [ "/usr/bin/traefik" ]

LABEL \
org.opencontainers.image.title="traefik" \
org.opencontainers.image.source="https://github.com/f-bn/containers-images/traefik" \
org.opencontainers.image.description="The Cloud Native Application Proxy" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.authors="Florian Bobin <[email protected]>"
17 changes: 17 additions & 0 deletions traefik/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## General informations

Custom Traefik image built from sources.

Built with Go 1.23 and NodeJS 22.

## Traefik configuration

This image doesn't come with a default Traefik configuration. You can bring your own configuration to the container using command flags or by passing the static configuration file using bind-mount:

```shell
# Configuration flags
$ docker run [options] ghcr.io/f-bn/traefik:3.3.3 --log.level=INFO --api [flags]

# Mounting static configuration
$ docker run [options] -v traefik.yaml:/etc/traefik/traefik.yaml:ro ghcr.io/f-bn/traefik:3.3.3
```

0 comments on commit a95bce3

Please sign in to comment.