Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FROM --platform=$BUILDPLATFORM golang:1.17-alpine AS build
WORKDIR /go/src/github.com/docker/cli
ENV GO111MODULE=auto
ARG TARGETOS TARGETARCH
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o /out/docker ./cmd/docker
FROM alpine
COPY --from=build /out/docker /bin
FROM golang:1.17-alpine AS build
WORKDIR /go/src/github.com/docker/cli
COPY . .
ENV GO111MODULE=auto
RUN go build -o /out/docker ./cmd/docker
FROM alpine
COPY --from=build /out/docker /bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment