Skip to content

Commit

Permalink
feat(docker): add Dockerfile and configure multi-arch Docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
yarlson committed Jan 25, 2025
1 parent 54f2b98 commit dca8214
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
34 changes: 30 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ version: 2
project_name: zero

builds:
- id: zero
main: ./main.go
- env:
- CGO_ENABLED=0
binary: zero
goos:
- linux
- darwin
Expand All @@ -14,8 +15,6 @@ builds:
- arm64
ldflags:
- -s -w -X main.version={{.Version}}
env:
- CGO_ENABLED=0

archives:
- id: release_archive
Expand All @@ -24,6 +23,33 @@ archives:
- LICENSE
- README.md

dockers:
- image_templates:
- "yarlson/zero:{{ .Version }}-amd64"
- "yarlson/zero:latest-amd64"
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/amd64"

- image_templates:
- "yarlson/zero:{{ .Version }}-arm64"
- "yarlson/zero:latest-arm64"
goarch: arm64
dockerfile: Dockerfile
build_flag_templates:
- "--platform=linux/arm64"

docker_manifests:
- name_template: "yarlson/zero:{{ .Version }}"
image_templates:
- "yarlson/zero:{{ .Version }}-amd64"
- "yarlson/zero:{{ .Version }}-arm64"

- name_template: "yarlson/zero:latest"
image_templates:
- "yarlson/zero:latest-amd64"
- "yarlson/zero:latest-arm64"

release:
github:
owner: yarlson
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.21 AS certs
RUN apk --no-cache add ca-certificates

FROM scratch

# Copy CA certificates from Alpine
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Copy our binary
COPY zero /usr/local/bin/zero

# Set the entrypoint
ENTRYPOINT ["/usr/local/bin/zero"]

0 comments on commit dca8214

Please sign in to comment.