2022-01-02 16:00:50 +00:00
|
|
|
# syntax=docker/dockerfile:1.3
|
|
|
|
|
2021-07-06 03:43:13 +00:00
|
|
|
ARG GO_VERSION=1.17
|
2022-01-02 16:00:50 +00:00
|
|
|
ARG GORELEASER_XX_VERSION=1.2.5
|
2020-01-29 12:15:29 +00:00
|
|
|
|
2022-01-02 16:00:50 +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 /src
|
2015-06-01 10:15:53 +00:00
|
|
|
|
2022-01-02 16:00:50 +00:00
|
|
|
FROM base AS build
|
2021-08-10 09:45:30 +00:00
|
|
|
ENV GO111MODULE=auto
|
2022-01-02 16:00:50 +00:00
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ARG TARGETPLATFORM
|
|
|
|
ARG PKG="github.com/distribution/distribution/v3"
|
|
|
|
ARG BUILDTAGS="include_oss include_gcs"
|
|
|
|
RUN --mount=type=bind,target=/src,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"
|
|
|
|
|
|
|
|
FROM scratch AS artifacts
|
|
|
|
COPY --from=build /out/*.tar.gz /
|
|
|
|
COPY --from=build /out/*.zip /
|
|
|
|
|
|
|
|
FROM scratch AS binary
|
|
|
|
COPY --from=build /usr/local/bin/registry* /
|
2014-12-10 23:57:41 +00:00
|
|
|
|
2021-08-10 09:45:30 +00:00
|
|
|
FROM alpine:3.14
|
2022-01-02 16:00:50 +00:00
|
|
|
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-02 16:00:50 +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"]
|