diff options
author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2020-01-10 18:42:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-10 18:42:26 +0100 |
commit | 4d63209d94276d66d9db39174bfe0127f4b9a8dc (patch) | |
tree | 160b0b40a4d840c459df0b7ace8f01e00a9e2661 | |
parent | 1d699d40f4890a3832320bd511e5a85ce611a1ad (diff) | |
parent | 50f1e205e48dc6ef646c0d0035ae18080dc8adf3 (diff) | |
download | docker-cpuguy-test-sync.tar.gz |
Merge pull request #40362 from thaJeztah/dockerfile_registry_optimizedcpuguy-test-sync
Dockerfile: also build old registry on armhf, and small optimization
-rw-r--r-- | Dockerfile | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/Dockerfile b/Dockerfile index 87eed4ea89..1ae303e157 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,42 +37,44 @@ RUN mkdir -p /usr/src/criu \ && make PREFIX=/build/ install-criu FROM base AS registry -# Install two versions of the registry. The first is an older version that -# only supports schema1 manifests. The second is a newer version that supports -# both. This allows integration-cli tests to cover push/pull with both schema1 -# and schema2 manifests. +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 +# push/pull with both schema1 and schema2 manifests. +# The old version of the registry is not working on arm64, so installation is +# skipped on that architecture. 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|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"; \ + amd64|armhf|ppc64*|s390x) \ + 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 |