5 Commits

Author SHA1 Message Date
06028eb5d6 ci: only deploy on relevant code changes
All checks were successful
CI / test (pull_request) Successful in 1m19s
2025-04-13 18:36:45 +02:00
050d309957 Add renovate.json
All checks were successful
CI / test (pull_request) Successful in 3m10s
2025-04-13 16:32:42 +00:00
ad20ad46b0 chore: slimmer docker base image & binary (#29)
All checks were successful
CD / test (push) Successful in 2m26s
CD / Build and push (amd64) (push) Successful in 1m37s
CD / Build and push (arm64) (push) Successful in 3m54s
CD / Create manifest (push) Successful in 11s
Reduction of 352 MiB -> 8.22 MiB

Reviewed-on: #29
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-02-16 20:27:29 +01:00
ccf4f5dbbb ci: refactor CD to only publish a single OCI manifest for all arches (#28)
All checks were successful
CD / test (push) Successful in 2m21s
CD / Build and push (amd64) (push) Successful in 53s
CD / Build and push (arm64) (push) Successful in 2m11s
CD / Create manifest (push) Successful in 11s
Reviewed-on: #28
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-01-18 22:28:30 +01:00
e53827adf0 ci: refactor multi arch build (#27)
All checks were successful
CD / test (push) Successful in 1m34s
CD / Build and push (amd64) (push) Successful in 57s
CD / Build and push (arm64) (push) Successful in 2m19s
Reviewed-on: #27
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-01-07 19:08:58 +01:00
3 changed files with 82 additions and 28 deletions

View File

@@ -9,6 +9,27 @@ env:
DOCKER_REGISTRY: gitea.t000-n.de
jobs:
check-changes:
name: Check changes
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.code }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
code:
- 'go.mod'
- 'go.sum'
- '**/*.go'
- 'config.example.yaml'
- 'Dockerfile'
- 'Makefile'
test:
name: test
runs-on: ubuntu-latest
@@ -44,18 +65,58 @@ jobs:
build_and_push:
name: Build and push
strategy:
matrix:
arch: [amd64, arm64]
needs:
- test
- check-changes
if: ${{ needs.check-changes.outputs.code == 'true' }}
runs-on:
- ubuntu-latest
- linux_${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Metadata
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
provenance: false
build-args: GOARCH=${{ matrix.arch }}
tags: |
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-${{ matrix.arch }}
create_manifest:
name: Create manifest
needs:
- build_and_push
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get Metadata
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
- name: Login to Registry
uses: docker/login-action@v2
@@ -64,21 +125,10 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Get Metadata
id: meta
- name: Create manifest
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}' | tr '[:upper:]' '[:lower:]') >> $GITHUB_OUTPUT
echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT
docker manifest create ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest \
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-amd64 \
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}-arm64
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }}
${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest
docker manifest push ${{ env.DOCKER_REGISTRY }}/t.behrendt/${{ steps.meta.outputs.REPO_NAME }}:latest

View File

@@ -1,13 +1,14 @@
FROM golang:1.23-alpine
FROM golang:1.23-alpine as build
ARG GOARCH=amd64
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${GOARCH} \
go build -trimpath -ldflags="-s -w" -o main .
RUN go build -o main .
CMD ["./main"]
FROM gcr.io/distroless/static-debian12
COPY --from=build /app/main /
CMD ["/main"]

3
renovate.json Normal file
View File

@@ -0,0 +1,3 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
}