Skip to content

Commit

Permalink
docker: Correct multi platform build for ARM (#936)
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli authored Apr 11, 2023
1 parent ee9f401 commit db2b491
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.2-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.20.2-alpine AS builder
WORKDIR /go/src/github.com/tus/tusd

# Add gcc and libc-dev early so it is cached
Expand All @@ -19,8 +19,12 @@ COPY pkg/ ./pkg/
ARG GIT_VERSION
ARG GIT_COMMIT

# Get the operating system and architecture to build for
ARG TARGETOS
ARG TARGETARCH

RUN set -xe \
&& GOOS=linux GOARCH=amd64 go build \
&& GOOS=$TARGETOS GOARCH=$TARGETARCH go build \
-ldflags="-X github.com/tus/tusd/cmd/tusd/cli.VersionName=${GIT_VERSION} -X github.com/tus/tusd/cmd/tusd/cli.GitCommit=${GIT_COMMIT} -X 'github.com/tus/tusd/cmd/tusd/cli.BuildDate=$(date --utc)'" \
-o /go/bin/tusd ./cmd/tusd/main.go

Expand Down

0 comments on commit db2b491

Please sign in to comment.