-
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
131 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,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 |
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,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]>" |
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,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 | ||
``` |