Skip to content

Commit

Permalink
Merge pull request #6 from Snawoot/docker-crosscompile
Browse files Browse the repository at this point in the history
docker: crosscompile
  • Loading branch information
Snawoot authored Sep 30, 2023
2 parents 85ac6cf + 42b0664 commit c9fbebc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM golang AS build
FROM --platform=$BUILDPLATFORM golang AS build

ARG GIT_DESC=undefined

WORKDIR /go/src/github.com/Snawoot/dtlspipe
COPY . .
RUN CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static" -X main.version='"$GIT_DESC" ./cmd/dtlspipe
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static" -X main.version='"$GIT_DESC" ./cmd/dtlspipe

FROM scratch
COPY --from=build /go/src/github.com/Snawoot/dtlspipe/dtlspipe /
Expand Down

0 comments on commit c9fbebc

Please sign in to comment.