ci: publish arm64 based docker images (!108)

* Update `goreleaser` config to publish `arm64` based docker images
* Remove manual image tagging script and replace with `goreleaser` config

https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter/-/merge_requests/108
This commit is contained in:
Hector 2023-09-07 20:29:30 +00:00
parent e80e361068
commit 970bbb51d4
No known key found for this signature in database
3 changed files with 47 additions and 30 deletions

View file

@ -62,17 +62,3 @@ release:
-e DOCKER_USERNAME -e DOCKER_PASSWORD -e DOCKER_REGISTRY \
-e GITLAB_TOKEN \
goreleaser/goreleaser release --clean
tag images:
stage: release
image: docker:stable
services:
- docker:dind
needs:
- release
rules:
- if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/
variables:
IMAGE_NAME: registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
script:
- ./.gitlab-ci/tagLatestImage.sh

View file

@ -1,14 +0,0 @@
#!/bin/sh
VERSION=`echo $CI_COMMIT_TAG | cut -c 2-`
MAJOR=`echo $VERSION | cut -d "." -f 1`
MINOR=`echo $VERSION | cut -d "." -f 2`
echo "version: $VERSION (major: $MAJOR; minor: $MINOR)"
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
docker pull $IMAGE_NAME:$VERSION
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:latest
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$MAJOR
docker tag $IMAGE_NAME:$VERSION $IMAGE_NAME:$MAJOR.$MINOR
docker push $IMAGE_NAME

View file

@ -15,9 +15,15 @@ builds:
- "7"
dockers:
- image_templates: ["registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}"]
dockerfile: Dockerfile
- image_templates:
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-amd64"
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-amd64"
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-amd64'
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-amd64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
@ -26,6 +32,45 @@ dockers:
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=MIT
- image_templates:
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-arm64"
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-arm64"
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-arm64'
- "registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-arm64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/arm64"
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.description={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
- --label=org.opencontainers.image.source=https://gitlab.com/hectorjsmith/fail2ban-prometheus-exporter
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}
- --label=org.opencontainers.image.licenses=MIT
goarch: arm64
docker_manifests:
- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}'
image_templates:
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-amd64'
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}-arm64'
- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}'
image_templates:
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-amd64'
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Major }}.{{ .Minor }}-arm64'
- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}'
image_templates:
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-amd64'
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:{{ .Version }}-arm64'
- name_template: 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest'
image_templates:
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-amd64'
- 'registry.gitlab.com/hectorjsmith/fail2ban-prometheus-exporter:latest-arm64'
changelog:
groups: