From ed70eb81cd7994c5771c2c2f98a186fa9db7f533 Mon Sep 17 00:00:00 2001 From: Antoine Aflalo <197810+Belphemur@users.noreply.github.com> Date: Tue, 26 Aug 2025 22:59:13 -0400 Subject: [PATCH] ci: update to new setup for docker images --- .goreleaser.yml | 50 ++++++++++++++++--------------------------------- Dockerfile | 19 ++++++++++--------- 2 files changed, 26 insertions(+), 43 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 9cf8c35..070ecf5 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -65,34 +65,26 @@ sboms: - artifacts: archive - id: source # Two different sbom configurations need two different IDs artifacts: source -# create a docker image +# create docker images # https://goreleaser.com/customization/docker -dockers: - - image_templates: - - "ghcr.io/belphemur/cbzoptimizer:latest-amd64" - - "ghcr.io/belphemur/cbzoptimizer:{{ .Version }}-amd64" +dockers_v2: + - images: + - "ghcr.io/belphemur/cbzoptimizer" + tags: + - "{{ .Version }}" + - "latest" + platforms: + - "linux/amd64" + - "linux/arm64" use: buildx + labels: + "org.opencontainers.image.created": "{{.Date}}" + "org.opencontainers.image.name": "{{.ProjectName}}" + "org.opencontainers.image.revision": "{{.FullCommit}}" + "org.opencontainers.image.version": "{{.Version}}" + "org.opencontainers.image.source": "{{.GitURL}}" build_flag_templates: - "--pull" - - "--platform=linux/amd64" - - "--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}}" - - 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 # 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 @@ -115,18 +107,8 @@ docker_signs: - cmd: cosign env: - COSIGN_EXPERIMENTAL=1 - artifacts: images output: true args: - "sign" - "${artifact}" - "--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" diff --git a/Dockerfile b/Dockerfile index 16edbc9..89ff61a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,22 @@ -FROM alpine:latest +FROM alpine LABEL authors="Belphemur" ARG APP_PATH=/usr/local/bin/CBZOptimizer +ARG TARGETPLATFORM ENV USER=abc ENV CONFIG_FOLDER=/config ENV PUID=99 RUN mkdir -p "${CONFIG_FOLDER}" && \ adduser \ - -S \ - -H \ - -h "${CONFIG_FOLDER}" \ - -G "users" \ - -u "${PUID}" \ - "${USER}" && \ - chown ${PUID}:users "${CONFIG_FOLDER}" + -S \ + -H \ + -h "${CONFIG_FOLDER}" \ + -G "users" \ + -u "${PUID}" \ + "${USER}" && \ + chown ${PUID}:users "${CONFIG_FOLDER}" -COPY CBZOptimizer ${APP_PATH} +COPY $TARGETPLATFORM/CBZOptimizer ${APP_PATH} RUN apk add --no-cache \ inotify-tools \