Skip to content

Commit

Permalink
build: add GOARCH env to go build
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-mlr committed Nov 7, 2024
1 parent 30b1a83 commit 5f13f9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ COPY --from=templ-stage /templ /tailwind
RUN npx tailwindcss -i ./input.css -o ./public/css/style.css --minify

# Go build
FROM golang:alpine AS build-stage
FROM --platform=$BUILDPLATFORM golang:alpine AS build-stage
ARG TARGETOS
ARG TARGETARCH
RUN apk add --no-cache --update go gcc g++
COPY --from=tailwind-stage /tailwind /app
WORKDIR /app
RUN CGO_ENABLED=1 GOOS=linux go build -o /app/main -buildvcs=false
RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o /app/main -buildvcs=false

# Go test
FROM build-stage AS test-stage
Expand Down

0 comments on commit 5f13f9d

Please sign in to comment.