mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
e5d28115ee
- all changes here are attributed to difference in behaviour between, namely: - resolution of secondary test dependencies - prunning of non-Go files Signed-off-by: Ilya Dmitrichenko <errordeveloper@gmail.com> Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
29 lines
686 B
Docker
29 lines
686 B
Docker
#syntax=docker/dockerfile:1.2
|
|
ARG GO_VERSION=1.16
|
|
|
|
FROM --platform=amd64 tonistiigi/xx:golang AS goxx
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
|
|
RUN apk add --no-cache gcc musl-dev
|
|
COPY --from=goxx / /
|
|
WORKDIR /src
|
|
|
|
FROM base AS build
|
|
ARG TARGETPLATFORM
|
|
RUN --mount=target=. \
|
|
--mount=target=/root/.cache,type=cache \
|
|
go build ./...
|
|
|
|
FROM base AS test
|
|
RUN --mount=target=. \
|
|
--mount=target=/root/.cache,type=cache \
|
|
go test -test.v ./...
|
|
|
|
FROM base AS test-noroot
|
|
RUN mkdir /go/pkg && chmod 0777 /go/pkg
|
|
USER 1000:1000
|
|
RUN --mount=target=. \
|
|
--mount=target=/tmp/.cache,type=cache \
|
|
GOCACHE=/tmp/gocache go test -test.v ./...
|
|
|
|
FROM build
|