Skip to content

Commit f64d6f2

Browse files
committed
Fix Dockerfile to work with GoReleaser output structure
- Use ARG TARGETARCH (built-in Docker Buildx arg) instead of custom BUILDARCH - Copy binaries from GoReleaser output structure: dist/nix_linux_amd64_v1/temporal - Add multi-stage dist build to properly handle GoReleaser output paths - Remove unnecessary TARGETPLATFORM from workflows and docker-bake.hcl - Ensure Docker build works correctly with actual GoReleaser binary locations
1 parent 2d3086e commit f64d6f2

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/build-and-publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ jobs:
222222
IMAGE_NAMESPACE: ${{ steps.meta.outputs.image_namespace }}
223223
IMAGE_NAME: ${{ steps.meta.outputs.image_name }}
224224
GITHUB_REPOSITORY: ${{ github.repository }}
225+
TARGETPLATFORM: linux/amd64,linux/arm64

Dockerfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
# syntax=docker/dockerfile:1
22

3-
# Build stage to extract CA certificates and create user files
3+
ARG TARGETARCH
4+
5+
# Build stage - copy binaries from goreleaser output
6+
FROM --platform=$TARGETARCH scratch AS dist
7+
COPY dist/nix_linux_amd64_v1/temporal /dist/amd64/temporal
8+
COPY dist/nix_linux_arm64_v8.0/temporal /dist/arm64/temporal
9+
10+
# Stage to extract CA certificates and create user files
411
FROM alpine:3.22@sha256:4b7ce07002c69e8f3d704a9c5d6fd3053be500b7f1c69fc0d80990c2ad8dd412 AS certs
512
RUN apk add --no-cache ca-certificates && \
613
adduser -u 1000 -D temporal
714

815
# Final scratch stage - completely minimal base
916
FROM scratch
1017

18+
ARG TARGETARCH
19+
1120
# Copy CA certificates from certs stage
1221
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
1322

@@ -16,10 +25,9 @@ COPY --from=certs /etc/passwd /etc/passwd
1625
COPY --from=certs /etc/group /etc/group
1726

1827
# Copy the appropriate binary for target architecture
19-
ARG TARGETARCH
20-
COPY dist/nix_linux_${TARGETARCH}/temporal /temporal
28+
COPY --from=dist /dist/$TARGETARCH/temporal /temporal
2129

22-
# Run as non-root user temporal (uid 1000)
23-
USER 1000:1000
30+
# Run as non-root user temporal
31+
USER temporal:temporal
2432

2533
ENTRYPOINT ["/temporal"]

0 commit comments

Comments
 (0)