Skip to content

Commit 5ed0b22

Browse files
authored
Merge pull request #44 from akerouanton/bake-crosscompile-shim
bakefile: add the ability to cross-compile the shim
2 parents ee7acd2 + 3ffa4d2 commit 5ed0b22

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,13 @@ ARG GO_DEBUG_GCFLAGS
9595
ARG GO_GCFLAGS
9696
ARG GO_BUILD_FLAGS
9797
ARG GO_LDFLAGS
98+
ARG TARGETOS
99+
ARG TARGETARCH
98100
ARG TARGETPLATFORM
99101

100102
RUN --mount=type=bind,target=.,rw \
101103
--mount=type=cache,target=/root/.cache/go-build,id=shim-build-$TARGETPLATFORM \
102-
go build ${GO_DEBUG_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o /build/containerd-shim-nerdbox-v1 ${GO_LDFLAGS} -tags 'no_grpc' ./cmd/containerd-shim-nerdbox-v1
104+
GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build ${GO_DEBUG_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o /build/containerd-shim-nerdbox-v1 ${GO_LDFLAGS} -tags 'no_grpc' ./cmd/containerd-shim-nerdbox-v1
103105

104106
FROM base AS vminit-build
105107

0 commit comments

Comments
 (0)