Skip to content

Commit

Permalink
chore: add ROCK for traefik v2.11.3 (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Github Actions <[email protected]>
  • Loading branch information
github-actions[bot] and Github Actions authored May 28, 2024
1 parent dc5923c commit 0f5c291
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 0 deletions.
13 changes: 13 additions & 0 deletions 2.11.3/files/traefik.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
log:
level: DEBUG

providers:
file:
directory: /etc/traefik
watch: true

entryPoints:
web:
address: ":8080"
websecure:
address: ":8081"
108 changes: 108 additions & 0 deletions 2.11.3/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: traefik
summary: Traefik in a ROCK.
description: "Traefik is the a cloud-native application networking stack."
version: "2.11.3"
base: [email protected]
license: Apache-2.0
# sources:
# jnsgruk's traefik dockerfile https://github.com/jnsgruk/traefik-oci-image/blob/main/Dockerfile
# upstream traefik makefile https://github.com/traefik/traefik/blob/84a081054688349fa4e2513599e3bf2395331492/Makefile

# /
# ├── bin
# │ └── traefik
# └── etc
# └── traefik.yaml
services:
traefik:
command: /bin/traefik
override: replace
startup: enabled
platforms:
amd64:
parts:
traefik-frontend:
plugin: npm
source-type: git
source-depth: 1
source-tag: "v2.11.3"
source: https://github.com/traefik/traefik
npm-node-version: 14.16
build-packages:
- nodejs
- npm
override-build: |
npm install -g yarn && \
cd ./webui && \
# added --legacy-peer-deps to avoid dependency resolution errors with mocha (testing)
npm install --legacy-peer-deps && \
# Build the bundle as per:
# https://github.com/traefik/traefik/blob/84a081054688349fa4e2513599e3bf2395331492/Makefile#L66
npm run build:nc && \
# cleanup
rm -rf node_modules
default-config:
plugin: dump
source: files
organize:
traefik.yaml: etc/traefik/traefik.yaml
stage:
- etc/traefik/traefik.yaml
traefik:
plugin: go
source-type: git
source-depth: 1
source-tag: "v2.11.3"
source: https://github.com/traefik/traefik
build-snaps:
- yq
- go/1.22/stable
build-environment:
- GO111MODULE: "on"
- CGO_ENABLED: "0"
- GOGC: "off"
- TRAEFIK_VERSION: v2.11.3
override-build: |
CODENAME=$(yq e '.blocks[] | select(.name=="Release").task.env_vars[] | select(.name=="CODENAME").value' ./.semaphore/semaphore.yml) && \
mkdir -p dist && \
# Required to merge non-code components into the final binary such as the web dashboard/UI
go generate && \
# Build Traefik per https://github.com/traefik/traefik/raw/v2.6.1/script/binary
go build -ldflags "-s -w \
-X github.com/traefik/traefik/v2/pkg/version.Version=$TRAEFIK_VERSION \
-X github.com/traefik/traefik/v2/pkg/version.Codename=$CODENAME \
-X github.com/traefik/traefik/v2/pkg/version.BuildDate=$(date -u '+%Y-%m-%d_%I:%M:%S%p')" \
-a -installsuffix nocgo -o $CRAFT_PART_INSTALL/traefik ./cmd/traefik
after:
- traefik-frontend
organize:
traefik: bin/traefik
stage:
- bin/traefik
stage-packages:
- ca-certificates
# We moved this here because: https://github.com/canonical/rockcraft/issues/343
ca-certs:
plugin: nil
overlay-packages: [ca-certificates]
non-root-user:
plugin: nil
after: [default-config]
overlay-script: |
# Create a user in the $CRAFT_OVERLAY chroot
groupadd -R $CRAFT_OVERLAY -g 1000 traefik
useradd -R $CRAFT_OVERLAY -M -r -g traefik -u 1000 traefik
override-prime: |
craftctl default
chown -R 1000:1000 etc/traefik
deb-security-manifest:
plugin: nil
after:
- traefik
- traefik-frontend
- ca-certs
override-prime: |
set -x
mkdir -p $CRAFT_PRIME/usr/share/rocks/
(echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query --admindir=$CRAFT_PRIME/var/lib/dpkg/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > $CRAFT_PRIME/usr/share/rocks/dpkg.query
# TODO verification steps and testing framework

0 comments on commit 0f5c291

Please sign in to comment.