Skip to content

Commit 00673f5

Browse files
authored
BUILD: Migrate GoReleaser Docker config to dockers_v2 (#4095)
GoReleaser has deprecated `dockers` and `docker_manifests` in favor of `dockers_v2`. The legacy configuration will eventually be removed. This PR migrates to the new format before it becomes a breaking change. See: https://goreleaser.com/deprecations#dockers - Migrate `dockers` and `docker_manifests` to `dockers_v2` - Remove redundant `GO111MODULE=on` (default since Go 1.16) ```shell goreleaser build --snapshot --clean ``` ```diff goreleaser build --snapshot --clean • skipping validate... • cleaning distribution directory • loading environment variables • getting and validating git state • git state commit=2738bff94d0096ec8d84866ff6ef439b6da05cbf branch=main current_tag=v4.34.0 previous_tag=v4.33.1 dirty=true • pipe skipped or partially skipped reason=disabled during snapshot mode • parsing tag • setting defaults - • dockers and docker_manifests are being phased out and will eventually be replaced by dockers_v2, check https://goreleaser.com/deprecations#dockers for more info - • dockers and docker_manifests are being phased out and will eventually be replaced by dockers_v2, check https://goreleaser.com/deprecations#dockers for more info • snapshotting • building snapshot... version=4.34.1-next • running before hooks • running hook=go fmt ./... • running hook=go mod tidy • running hook=go generate ./... • ensuring distribution directory • setting up metadata • writing release metadata • loading go mod information • build prerequisites • building binaries • building binary=dist/build_linux_amd64_v1/dnscontrol • building binary=dist/build_darwin_amd64_v1/dnscontrol • building binary=dist/build_freebsd_amd64_v1/dnscontrol • building binary=dist/build_linux_arm64_v8.0/dnscontrol • building binary=dist/build_freebsd_arm64_v8.0/dnscontrol • building binary=dist/build_windows_amd64_v1/dnscontrol.exe • building binary=dist/build_windows_arm64_v8.0/dnscontrol.exe • building binary=dist/build_darwin_arm64_v8.0/dnscontrol • universal binaries • creating from 2 binaries id=build binary=dist/build_darwin_all/dnscontrol • sign & notarize macOS binaries • pipe skipped or partially skipped reason=disabled • writing artifacts metadata • build succeeded after 6s • thanks for using GoReleaser! ```
1 parent 2738bff commit 00673f5

File tree

2 files changed

+20
-54
lines changed

2 files changed

+20
-54
lines changed

.goreleaser.yml

Lines changed: 18 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ builds:
66
id: build
77
env:
88
- CGO_ENABLED=0
9-
- GO111MODULE=on
109
goos:
1110
- linux
1211
- windows
@@ -96,58 +95,24 @@ nfpms:
9695
license: MIT
9796
formats:
9897
- deb
99-
dockers:
100-
- image_templates:
101-
- &amd_image "stackexchange/{{.ProjectName}}:{{ .Version }}-amd64"
102-
- &amd_image_ghcr "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}-amd64"
103-
goos: linux
104-
goarch: amd64
105-
use: buildx
106-
ids:
107-
- build
108-
build_flag_templates:
109-
- "--pull"
110-
- "--platform=linux/amd64"
111-
- "--label=org.opencontainers.image.created={{ .Date }}"
112-
- "--label=org.opencontainers.image.name={{ .ProjectName }}"
113-
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
114-
- "--label=org.opencontainers.image.version={{ .Version }}"
115-
- "--label=org.opencontainers.image.source={{ .GitURL }}"
116-
- image_templates:
117-
- &arm_image "stackexchange/{{.ProjectName}}:{{ .Version }}-arm64"
118-
- &arm_image_ghcr "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}-arm64"
119-
goos: linux
120-
goarch: arm64
121-
use: buildx
122-
ids:
123-
- build
124-
build_flag_templates:
125-
- "--pull"
126-
- "--platform=linux/arm64"
127-
- "--label=org.opencontainers.image.created={{ .Date }}"
128-
- "--label=org.opencontainers.image.name={{ .ProjectName }}"
129-
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
130-
- "--label=org.opencontainers.image.version={{ .Version }}"
131-
- "--label=org.opencontainers.image.source={{ .GitURL }}"
132-
docker_manifests:
133-
- name_template: "stackexchange/{{.ProjectName}}:{{ .Version }}"
134-
image_templates:
135-
- *amd_image
136-
- *arm_image
137-
- name_template: "ghcr.io/stackexchange/{{.ProjectName}}:{{ .Version }}"
138-
image_templates:
139-
- *amd_image_ghcr
140-
- *arm_image_ghcr
141-
- name_template: "stackexchange/{{.ProjectName}}:latest"
142-
skip_push: auto
143-
image_templates:
144-
- *amd_image
145-
- *arm_image
146-
- name_template: "ghcr.io/stackexchange/{{.ProjectName}}:latest"
147-
skip_push: auto
148-
image_templates:
149-
- *amd_image_ghcr
150-
- *arm_image_ghcr
98+
dockers_v2:
99+
- ids:
100+
- build
101+
images:
102+
- "stackexchange/{{.ProjectName}}"
103+
- "ghcr.io/stackexchange/{{.ProjectName}}"
104+
tags:
105+
- "{{ .Version }}"
106+
- "{{ if not .IsSnapshot }}latest{{ end }}"
107+
platforms:
108+
- linux/amd64
109+
- linux/arm64
110+
labels:
111+
"org.opencontainers.image.created": "{{ .Date }}"
112+
"org.opencontainers.image.name": "{{ .ProjectName }}"
113+
"org.opencontainers.image.revision": "{{ .FullCommit }}"
114+
"org.opencontainers.image.version": "{{ .Version }}"
115+
"org.opencontainers.image.source": "{{ .GitURL }}"
151116
notarize:
152117
macos:
153118
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ FROM alpine:3.23.3@sha256:25109184c71bdad752c8312a8623239686a9a2071e8825f20acb8f
77
# - ca-certificates: Needed for https to work properly
88
RUN apk update && apk add --no-cache tzdata ca-certificates && update-ca-certificates
99

10-
COPY dnscontrol /usr/local/bin/
10+
ARG TARGETPLATFORM
11+
COPY $TARGETPLATFORM/dnscontrol /usr/local/bin/
1112

1213
WORKDIR /dns
1314

0 commit comments

Comments
 (0)