-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (23 loc) · 770 Bytes
/
Copy pathDockerfile
File metadata and controls
27 lines (23 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# syntax=docker/dockerfile:1
# xx is a helper for cross-compilation
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.9.0 AS xx
# osxcross contains the MacOSX cross toolchain for xx
FROM crazymax/osxcross:26.1-r0 AS osxcross
FROM --platform=$BUILDPLATFORM golang:1.26.1-alpine3.23 AS build
COPY --link --from=xx / /
RUN apk add --no-cache gcc clang llvm
ARG TARGETPLATFORM
RUN xx-apk add --no-cache gcc musl-dev
WORKDIR /src
ENV CGO_ENABLED=1
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=bind,from=osxcross,src=/osxsdk,target=/xx-sdk <<EOT
set -ex
xx-go --wrap
go build -o /out/demoit
xx-verify /out/demoit
EOT
FROM scratch AS binaries
COPY --link --from=build /out /