diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2020-01-10 14:07:01 +0100 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2020-01-10 15:31:14 +0100 |
commit | 50f1e205e48dc6ef646c0d0035ae18080dc8adf3 (patch) | |
tree | 783aea2e8993b6f28254334a65b97f4c02711d32 | |
parent | 95a47029433d21031e77f1546d4a7352f7f92a1f (diff) | |
download | docker-50f1e205e48dc6ef646c0d0035ae18080dc8adf3.tar.gz |
Dockerfile: use tmpfs for building registry, go-swagger
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rw-r--r-- | Dockerfile | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Dockerfile b/Dockerfile index e57a7e4d1a..1ae303e157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,6 +37,7 @@ RUN mkdir -p /usr/src/criu \ && make PREFIX=/build/ install-criu FROM base AS registry +WORKDIR /go/src/github.com/docker/distribution # Install two versions of the registry. The first one is a recent version that # supports both schema 1 and 2 manifests. The second one is an older version that # only supports schema1 manifests. This allows integration-cli tests to cover @@ -47,34 +48,33 @@ ENV REGISTRY_COMMIT_SCHEMA1 ec87e9b6971d831f0eff752ddb54fb64693e51cd ENV REGISTRY_COMMIT 47a064d4195a9b56133891bbb13620c3ac83a827 RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ + --mount=type=tmpfs,target=/go/src/ \ set -x \ - && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \ - && (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \ - && GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ + && git clone https://github.com/docker/distribution.git . \ + && git checkout -q "$REGISTRY_COMMIT" \ + && GOPATH="/go/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \ go build -buildmode=pie -o /build/registry-v2 github.com/docker/distribution/cmd/registry \ && case $(dpkg --print-architecture) in \ amd64|armhf|ppc64*|s390x) \ - (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT_SCHEMA1"); \ - GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH"; \ + git checkout -q "$REGISTRY_COMMIT_SCHEMA1"; \ + GOPATH="/go/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH"; \ go build -buildmode=pie -o /build/registry-v2-schema1 github.com/docker/distribution/cmd/registry; \ ;; \ - esac \ - && rm -rf "$GOPATH" + esac FROM base AS swagger +WORKDIR $GOPATH/src/github.com/go-swagger/go-swagger # Install go-swagger for validating swagger.yaml # This is https://github.com/kolyshkin/go-swagger/tree/golang-1.13-fix # TODO: move to under moby/ or fix upstream go-swagger to work for us. ENV GO_SWAGGER_COMMIT 5793aa66d4b4112c2602c716516e24710e4adbb5 RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ + --mount=type=tmpfs,target=/go/src/ \ set -x \ - && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/kolyshkin/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \ - && (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \ - && go build -o /build/swagger github.com/go-swagger/go-swagger/cmd/swagger \ - && rm -rf "$GOPATH" + && git clone https://github.com/kolyshkin/go-swagger.git . \ + && git checkout -q "$GO_SWAGGER_COMMIT" \ + && go build -o /build/swagger github.com/go-swagger/go-swagger/cmd/swagger FROM base AS frozen-images ARG DEBIAN_FRONTEND |