From 77bfe7907b3ceadb4e6518e8c1d917fbc17b8f37 Mon Sep 17 00:00:00 2001 From: Vladislav Yarmak Date: Sat, 30 Sep 2023 15:57:43 +0300 Subject: [PATCH] docker: crosscompile --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 256bde5..dca209f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ -FROM golang:1.21 AS build +FROM --platform=$BUILDPLATFORM golang:1.21 AS build ARG GIT_DESC=undefined WORKDIR /go/src/github.com/Snawoot/hola-proxy COPY . . -RUN CGO_ENABLED=0 go build -a -tags netgo -ldflags '-s -w -extldflags "-static" -X main.version='"$GIT_DESC" +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" ADD https://curl.haxx.se/ca/cacert.pem /certs.crt RUN chmod 0644 /certs.crt