chore: use goreleaser to publish Docker images
This commit is contained in:
parent
754051fcb4
commit
ec006d3466
1
.github/workflows/go-cross.yml
vendored
1
.github/workflows/go-cross.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@ -4,6 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -14,7 +15,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO_VERSION: stable
|
GO_VERSION: stable
|
||||||
GOLANGCI_LINT_VERSION: v1.61.0
|
GOLANGCI_LINT_VERSION: v1.61.0
|
||||||
SEIHON_VERSION: v0.9.0
|
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
32
.github/workflows/release.yml
vendored
32
.github/workflows/release.yml
vendored
@ -10,7 +10,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO_VERSION: stable
|
GO_VERSION: stable
|
||||||
SEIHON_VERSION: v0.9.0
|
|
||||||
CGO_ENABLED: 0
|
CGO_ENABLED: 0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -43,22 +42,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: ${{ env.GO_VERSION }}
|
go-version: ${{ env.GO_VERSION }}
|
||||||
|
|
||||||
- name: Make
|
|
||||||
run: make build
|
|
||||||
|
|
||||||
- name: Run GoReleaser
|
|
||||||
uses: goreleaser/goreleaser-action@v6
|
|
||||||
with:
|
|
||||||
version: v2
|
|
||||||
args: release -p 1 --clean --timeout=90m
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Install seihon ${{ env.SEIHON_VERSION }}
|
|
||||||
run: |
|
|
||||||
curl -sSfL https://raw.githubusercontent.com/ldez/seihon/master/godownloader.sh | sh -s -- -b $(go env GOPATH)/bin ${SEIHON_VERSION}
|
|
||||||
seihon --version
|
|
||||||
|
|
||||||
- name: Docker Login
|
- name: Docker Login
|
||||||
env:
|
env:
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
@ -66,5 +49,16 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
||||||
|
|
||||||
- name: Deploy Docker Images (seihon)
|
- name: Set up QEMU
|
||||||
run: make publish-images
|
uses: docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release -p 1 --clean --timeout=90m
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@ -47,3 +47,89 @@ archives:
|
|||||||
format: zip
|
format: zip
|
||||||
files:
|
files:
|
||||||
- LICENSE
|
- LICENSE
|
||||||
|
|
||||||
|
docker_manifests:
|
||||||
|
- name_template: 'ldez/traefik-certs-dumper:{{ .Tag }}'
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-amd64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-arm64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-armv7'
|
||||||
|
- name_template: 'ldez/traefik-certs-dumper:latest'
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-amd64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-arm64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-armv7'
|
||||||
|
- name_template: 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}'
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-amd64'
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-arm64'
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-armv7'
|
||||||
|
|
||||||
|
dockers:
|
||||||
|
- use: buildx
|
||||||
|
goos: linux
|
||||||
|
goarch: amd64
|
||||||
|
dockerfile: buildx.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:latest-amd64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-amd64'
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-amd64'
|
||||||
|
build_flag_templates:
|
||||||
|
- '--pull'
|
||||||
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||||
|
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
||||||
|
- '--label=org.opencontainers.image.description=Dump ACME data from Traefik to certificates'
|
||||||
|
- '--label=org.opencontainers.image.source={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/traefik-certs-dumper'
|
||||||
|
- '--label=org.opencontainers.image.created={{.Date}}'
|
||||||
|
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
|
||||||
|
- '--label=org.opencontainers.image.version={{.Version}}'
|
||||||
|
- '--platform=linux/amd64'
|
||||||
|
|
||||||
|
- use: buildx
|
||||||
|
goos: linux
|
||||||
|
goarch: arm64
|
||||||
|
dockerfile: buildx.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:latest-arm64'
|
||||||
|
- 'ldez/traefik-certs-dumper:latest-arm.v8' # only for compatibility with Seihon
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-arm64'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-arm.v8' # only for compatibility with Seihon
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-arm64'
|
||||||
|
build_flag_templates:
|
||||||
|
- '--pull'
|
||||||
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||||
|
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
||||||
|
- '--label=org.opencontainers.image.description=Dump ACME data from Traefik to certificates'
|
||||||
|
- '--label=org.opencontainers.image.source={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/traefik-certs-dumper'
|
||||||
|
- '--label=org.opencontainers.image.created={{.Date}}'
|
||||||
|
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
|
||||||
|
- '--label=org.opencontainers.image.version={{.Version}}'
|
||||||
|
- '--platform=linux/arm64'
|
||||||
|
|
||||||
|
- use: buildx
|
||||||
|
goos: linux
|
||||||
|
goarch: arm
|
||||||
|
goarm: '7'
|
||||||
|
dockerfile: buildx.Dockerfile
|
||||||
|
image_templates:
|
||||||
|
- 'ldez/traefik-certs-dumper:latest-armv7'
|
||||||
|
- 'ldez/traefik-certs-dumper:latest-arm.v7' # only for compatibility with Seihon
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-armv7'
|
||||||
|
- 'ldez/traefik-certs-dumper:{{ .Tag }}-arm.v7' # only for compatibility with Seihon
|
||||||
|
- 'ldez/traefik-certs-dumper:v{{ .Major }}.{{ .Minor }}-armv7'
|
||||||
|
build_flag_templates:
|
||||||
|
- '--pull'
|
||||||
|
# https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
|
||||||
|
- '--label=org.opencontainers.image.title={{.ProjectName}}'
|
||||||
|
- '--label=org.opencontainers.image.description=Dump ACME data from Traefik to certificates'
|
||||||
|
- '--label=org.opencontainers.image.source={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.url={{.GitURL}}'
|
||||||
|
- '--label=org.opencontainers.image.documentation=https://github.com/ldez/traefik-certs-dumper'
|
||||||
|
- '--label=org.opencontainers.image.created={{.Date}}'
|
||||||
|
- '--label=org.opencontainers.image.revision={{.FullCommit}}'
|
||||||
|
- '--label=org.opencontainers.image.version={{.Version}}'
|
||||||
|
- '--platform=linux/arm/v7'
|
||||||
|
|||||||
3
Makefile
3
Makefile
@ -25,6 +25,3 @@ checks:
|
|||||||
|
|
||||||
doc:
|
doc:
|
||||||
go run . doc
|
go run . doc
|
||||||
|
|
||||||
publish-images:
|
|
||||||
seihon publish -v "$(TAG_NAME)" -v "latest" --image-name ldez/traefik-certs-dumper --dry-run=false
|
|
||||||
|
|||||||
9
buildx.Dockerfile
Normal file
9
buildx.Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
|
FROM alpine:3
|
||||||
|
|
||||||
|
RUN apk --no-cache --no-progress add git ca-certificates tzdata jq \
|
||||||
|
&& rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
|
COPY traefik-certs-dumper /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/traefik-certs-dumper"]
|
||||||
@ -1,24 +0,0 @@
|
|||||||
FROM golang:1-alpine as builder
|
|
||||||
|
|
||||||
RUN apk --update upgrade \
|
|
||||||
&& apk --no-cache --no-progress add git make gcc musl-dev ca-certificates tzdata
|
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/ldez/traefik-certs-dumper
|
|
||||||
|
|
||||||
ENV GO111MODULE on
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
RUN GOARCH={{ .GoARCH }} GOARM={{ .GoARM }} make build
|
|
||||||
|
|
||||||
FROM {{ .RuntimeImage }}
|
|
||||||
|
|
||||||
# Not supported for multi-arch without Buildkit or QEMU
|
|
||||||
#RUN apk --update upgrade \
|
|
||||||
# && apk --no-cache --no-progress add ca-certificates
|
|
||||||
|
|
||||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
||||||
COPY --from=builder /go/src/github.com/ldez/traefik-certs-dumper/traefik-certs-dumper /usr/bin/traefik-certs-dumper
|
|
||||||
|
|
||||||
ENTRYPOINT ["/usr/bin/traefik-certs-dumper"]
|
|
||||||
Loading…
Reference in New Issue
Block a user