From 95a47029433d21031e77f1546d4a7352f7f92a1f Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 10 Jan 2020 14:32:46 +0100 Subject: [PATCH 1/2] Dockerfile: also build old registry on armhf Building the old version of the registry is not supported on arm64, but building on armhf is possible. Before using a multi-arch Dockerfile, the registry was built on armhf as well, but this got lost in the transition in commit f1701a741d77a92d28138944193e23aabfc74abe. This commit re-enables building the old registry on armhf. Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87eed4ea89..e57a7e4d1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,10 +37,12 @@ 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. +# 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 \ @@ -52,7 +54,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ && GOPATH="$GOPATH/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) \ + 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"; \ go build -buildmode=pie -o /build/registry-v2-schema1 github.com/docker/distribution/cmd/registry; \ From 50f1e205e48dc6ef646c0d0035ae18080dc8adf3 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 10 Jan 2020 14:07:01 +0100 Subject: [PATCH 2/2] Dockerfile: use tmpfs for building registry, go-swagger Signed-off-by: Sebastiaan van Stijn --- Dockerfile | 26 +++++++++++++------------- 1 file 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