Docker Registry 构建脚本: 添加 Git 代理和关闭 SSL 验证
FROM base AS registry WORKDIR /go/src/github.com/docker/distribution
REGISTRY_VERSION specifies the version of the registry to build and install
from the https://github.com/docker/distribution repository. This version of
the registry is used to test both schema 1 and schema 2 manifests. Generally,
the version specified here should match a current release.
ARG REGISTRY_VERSION=v2.3.0
REGISTRY_VERSION_SCHEMA1 specifies the version of the registry to build and
install from the https://github.com/docker/distribution repository. This is
an older (pre v2.3.0) version of the registry that only supports schema1
manifests. This version of the registry is not working on arm64, so installation
is skipped on that architecture.
ARG REGISTRY_VERSION_SCHEMA1=v2.1.0
ARG TARGETPLATFORM
RUN --mount=from=registry-src,src=/usr/src/registry,rw
--mount=type=cache,target=/root/.cache/go-build,id=registry-build-$TARGETPLATFORM
--mount=type=cache,target=/go/pkg/mod
--mount=type=tmpfs,target=/go/src <<EOT
set -ex
export GIT_SSL_NO_VERIFY=true
export http_proxy=http://your.git.proxy:port
export https_proxy=http://your.git.proxy:port
git fetch -q --depth 1 origin '$(REGISTRY_VERSION)' +refs/tags/:refs/tags/
git checkout -q FETCH_HEAD
export GOPATH="/go/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH"
CGO_ENABLED=0 xx-go build -o /build/registry-v2 -v ./cmd/registry
xx-verify /build/registry-v2
case $TARGETPLATFORM in
linux/amd64|linux/arm/v7|linux/ppc64le|linux/s390x)
git fetch -q --depth 1 origin '$(REGISTRY_VERSION_SCHEMA1)' +refs/tags/:refs/tags/
git checkout -q FETCH_HEAD
CGO_ENABLED=0 xx-go build -o /build/registry-v2-schema1 -v ./cmd/registry
xx-verify /build/registry-v2-schema1
;;
esac
EOT
原文地址: https://www.cveoy.top/t/topic/gXYJ 著作权归作者所有。请勿转载和采集!