Skip to content

Commit 21f7771

Browse files
authored
Merge pull request #79 from smlx/binaryvar
fix: simplify docker build
2 parents ea651a5 + ac6ebe7 commit 21f7771

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ jobs:
4747
push: true
4848
tags: ${{ steps.docker_metadata.outputs.tags }}
4949
labels: ${{ steps.docker_metadata.outputs.labels }}
50-
file: deploy/${{ matrix.binary }}/Dockerfile
50+
file: Dockerfile
51+
build-args: BINARY=${{ matrix.binary }}
5152
context: dist/${{ env.GITHUB_REPOSITORY_NAME }}_linux_amd64_v1

.goreleaser.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,33 @@ signs:
3737
artifacts: checksum
3838

3939
dockers:
40-
- image_templates:
41-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-amd64"
40+
- ids:
41+
- go-cli-github
42+
image_templates:
43+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-amd64"
4244
use: buildx
43-
dockerfile: deploy/{{ .ArtifactName }}/Dockerfile
4445
build_flag_templates:
46+
- "--build-arg=BINARY=go-cli-github"
4547
- "--platform=linux/amd64"
46-
- image_templates:
47-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-arm64v8"
48+
- ids:
49+
- go-cli-github
50+
image_templates:
51+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-arm64v8"
4852
use: buildx
4953
goarch: arm64
50-
dockerfile: deploy/{{ .ArtifactName }}/Dockerfile
5154
build_flag_templates:
55+
- "--build-arg=BINARY=go-cli-github"
5256
- "--platform=linux/arm64/v8"
5357

5458
docker_manifests:
55-
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}"
59+
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}"
5660
image_templates:
57-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-amd64"
58-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-arm64v8"
59-
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:latest"
61+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-amd64"
62+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-arm64v8"
63+
- name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:latest"
6064
image_templates:
61-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-amd64"
62-
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/{{ .ArtifactName }}:{{ .Version }}-arm64v8"
65+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-amd64"
66+
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}/go-cli-github:{{ .Version }}-arm64v8"
6367

6468
docker_signs:
6569
- args:
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
FROM alpine:3.19@sha256:51b67269f354137895d43f3b3d810bfacd3945438e94dc5ac55fdac340352f48
2-
ENTRYPOINT ["/go-cli-github"]
3-
COPY go-cli-github /
2+
ARG BINARY=binary-build-arg-not-defined
3+
ENTRYPOINT ["/${BINARY}"]
4+
COPY $BINARY /

0 commit comments

Comments
 (0)