2022-01-12 15:34:08 +00:00
|
|
|
# syntax=docker/dockerfile:1.3
|
2015-06-01 10:15:53 +00:00
|
|
|
|
2022-01-12 15:34:08 +00:00
|
|
|
ARG GO_VERSION=1.16
|
|
|
|
ARG GORELEASER_XX_VERSION=1.2.5
|
2015-01-29 23:37:22 +00:00
|
|
|
|
2022-01-12 15:34:08 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM crazymax/goreleaser-xx:${GORELEASER_XX_VERSION} AS goreleaser-xx
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine AS base
|
|
|
|
COPY --from=goreleaser-xx / /
|
|
|
|
RUN apk add --no-cache file git
|
|
|
|
WORKDIR /go/src/github.com/docker/distribution
|
2017-05-23 08:58:05 +00:00
|
|
|
|
2022-01-12 15:34:08 +00:00
|
|
|
FROM base AS build
|
|
|
|
ENV GO111MODULE=auto
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG PKG="github.com/distribution/distribution"
|
|
|
|
ARG BUILDTAGS="include_oss include_gcs"
|
|
|
|
RUN --mount=type=bind,rw \
|
|
|
|
--mount=type=cache,target=/root/.cache/go-build \
|
|
|
|
--mount=target=/go/pkg/mod,type=cache \
|
|
|
|
goreleaser-xx --debug \
|
|
|
|
--name="registry" \
|
|
|
|
--dist="/out" \
|
|
|
|
--main="./cmd/registry" \
|
|
|
|
--flags="-v" \
|
|
|
|
--ldflags="-s -w -X '$PKG/version.Version={{.Version}}' -X '$PKG/version.Revision={{.Commit}}' -X '$PKG/version.Package=$PKG'" \
|
|
|
|
--tags="$BUILDTAGS" \
|
|
|
|
--files="LICENSE" \
|
|
|
|
--files="README.md"
|
2016-07-21 23:14:32 +00:00
|
|
|
|
2022-01-12 15:34:08 +00:00
|
|
|
FROM scratch AS binary
|
|
|
|
COPY --from=build /usr/local/bin/registry* /
|
2014-12-10 23:57:41 +00:00
|
|
|
|
2022-01-12 15:34:08 +00:00
|
|
|
FROM alpine:3.14
|
|
|
|
RUN apk add --no-cache ca-certificates
|
2018-10-15 22:46:01 +00:00
|
|
|
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml
|
2022-01-12 15:34:08 +00:00
|
|
|
COPY --from=build /usr/local/bin/registry /bin/registry
|
2015-06-11 04:24:16 +00:00
|
|
|
VOLUME ["/var/lib/registry"]
|
2014-12-10 23:57:41 +00:00
|
|
|
EXPOSE 5000
|
2015-04-06 14:05:11 +00:00
|
|
|
ENTRYPOINT ["registry"]
|
2016-01-19 22:26:15 +00:00
|
|
|
CMD ["serve", "/etc/docker/registry/config.yml"]
|