ci: improve goreleaser config for docker image

This commit is contained in:
Antoine Aflalo
2025-09-09 20:46:08 -04:00
parent b5a894deba
commit 35bba7c088
2 changed files with 14 additions and 37 deletions

View File

@@ -67,32 +67,18 @@ sboms:
artifacts: source artifacts: source
# create a docker image # create a docker image
# https://goreleaser.com/customization/docker # https://goreleaser.com/customization/docker
dockers: dockers_v2:
- image_templates: - images:
- "ghcr.io/belphemur/cbzoptimizer:latest-amd64" - "ghcr.io/belphemur/cbzoptimizer"
- "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}-amd64" tags:
use: buildx - "{{ .Version }}"
build_flag_templates: - latest
- "--pull" labels:
- "--platform=linux/amd64" "org.opencontainers.image.created": "{{.Date}}"
- "--label=org.opencontainers.image.created={{.Date}}" "org.opencontainers.image.name": "{{.ProjectName}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}" "org.opencontainers.image.revision": "{{.FullCommit}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}" "org.opencontainers.image.version": "{{.Version}}"
- "--label=org.opencontainers.image.version={{.Version}}" "org.opencontainers.image.source": "{{.GitURL}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- image_templates:
- "ghcr.io/belphemur/cbzoptimizer:latest-arm64"
- "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}-arm64"
use: buildx
goarch: arm64
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
# signs the checksum file # signs the checksum file
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to # all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
# https://goreleaser.com/customization/sign # https://goreleaser.com/customization/sign
@@ -115,18 +101,8 @@ docker_signs:
- cmd: cosign - cmd: cosign
env: env:
- COSIGN_EXPERIMENTAL=1 - COSIGN_EXPERIMENTAL=1
artifacts: images
output: true output: true
args: args:
- "sign" - "sign"
- "${artifact}" - "${artifact}"
- "--yes" # needed on cosign 2.0.0+ - "--yes" # needed on cosign 2.0.0+
docker_manifests:
- name_template: "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}"
image_templates:
- "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}-amd64"
- "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}-arm64"
- name_template: "ghcr.io/belphemur/cbzoptimizer:latest"
image_templates:
- "ghcr.io/belphemur/cbzoptimizer:latest-amd64"
- "ghcr.io/belphemur/cbzoptimizer:latest-arm64"

View File

@@ -1,5 +1,6 @@
FROM debian:slim FROM debian:slim
LABEL authors="Belphemur" LABEL authors="Belphemur"
ARG TARGETPLATFORM
ARG APP_PATH=/usr/local/bin/CBZOptimizer ARG APP_PATH=/usr/local/bin/CBZOptimizer
ENV USER=abc ENV USER=abc
ENV CONFIG_FOLDER=/config ENV CONFIG_FOLDER=/config
@@ -14,7 +15,7 @@ RUN addgroup --system users && \
--disabled-password \ --disabled-password \
"${USER}" "${USER}"
COPY CBZOptimizer ${APP_PATH} COPY ${TARGETPLATFORM}/CBZOptimizer ${APP_PATH}
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
inotify-tools \ inotify-tools \