Add OCI image labels

This commit is contained in:
Nick Fedor 2025-02-08 11:22:50 -07:00
parent 53b5ab26a2
commit f82357b272
No known key found for this signature in database
GPG key ID: A167CBEDE64D29CB
3 changed files with 39 additions and 7 deletions

View file

@ -1,4 +1,6 @@
FROM --platform=$BUILDPLATFORM alpine:3.21.2 as alpine
ARG BASE_IMAGE=alpine:3.21.2
FROM --platform=$BUILDPLATFORM $BASE_IMAGE as alpine
RUN apk add --no-cache \
ca-certificates \
@ -6,6 +8,13 @@ RUN apk add --no-cache \
FROM scratch
LABEL "com.centurylinklabs.watchtower"="true"
LABEL "org.opencontainers.image.url"="https://nicholas-fedor.github.io/watchtower/" \
"org.opencontainers.image.documentation"="https://nicholas-fedor.github.io/watchtower/" \
"org.opencontainers.image.source"="https://github.com/nicholas-fedor/watchtower" \
"org.opencontainers.image.licenses"="Apache-2.0" \
"org.opencontainers.image.title"="Watchtower" \
"org.opencontainers.image.description"="A process for automating Docker container base image updates." \
"org.opencontainers.image.base.name"="$BASE_IMAGE"
COPY --from=alpine \
/etc/ssl/certs/ca-certificates.crt \

View file

@ -36,6 +36,13 @@ RUN \
FROM scratch
LABEL "com.centurylinklabs.watchtower"="true"
LABEL "org.opencontainers.image.url"="https://nicholas-fedor.github.io/watchtower/" \
"org.opencontainers.image.documentation"="https://nicholas-fedor.github.io/watchtower/" \
"org.opencontainers.image.source"="https://github.com/nicholas-fedor/watchtower" \
"org.opencontainers.image.licenses"="Apache-2.0" \
"org.opencontainers.image.title"="Watchtower" \
"org.opencontainers.image.description"="A process for automating Docker container base image updates." \
"org.opencontainers.image.base.name"="alpine"
# copy files from other container
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

View file

@ -10,11 +10,11 @@ build:
- arm
- arm64
ldflags:
- -s -w -X github.com/nicholas-fedor/watchtower/internal/meta.Version={{.Version}}
- -s -w -X github.com/nicholas-fedor/watchtower/internal/meta.Version={{ .Version }}
archives:
-
name_template: "{{.ProjectName}}_{{.Os}}_{{.Arch}}"
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: tar.gz
replacements:
arm: armhf
@ -31,7 +31,11 @@ archives:
dockers:
-
use_buildx: true
build_flag_templates: [ "--platform=linux/amd64" ]
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
goos: linux
goarch: amd64
goarm: ''
@ -43,7 +47,11 @@ dockers:
- ghcr.io/nicholas-fedor/watchtower:amd64-latest
-
use_buildx: true
build_flag_templates: [ "--platform=linux/i386" ]
build_flag_templates:
- "--platform=linux/i386"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
goos: linux
goarch: "386"
goarm: ''
@ -55,7 +63,11 @@ dockers:
- ghcr.io/nicholas-fedor/watchtower:i386-latest
-
use_buildx: true
build_flag_templates: [ "--platform=linux/arm/v6" ]
build_flag_templates:
- "--platform=linux/arm/v6"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
goos: linux
goarch: arm
goarm: 6
@ -67,7 +79,11 @@ dockers:
- ghcr.io/nicholas-fedor/watchtower:armhf-latest
-
use_buildx: true
build_flag_templates: [ "--platform=linux/arm64/v8" ]
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
goos: linux
goarch: arm64
goarm: ''