From de64f0442fc95b3579a517c3eeeb8ebf555cfad4 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Mon, 17 Apr 2023 12:02:21 -0400 Subject: [PATCH] use golang-specific builder --- Dockerfile | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 380cc7b..362a68e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,28 +1,24 @@ -FROM nephatrine/nxbuilder:alpine AS builder +FROM nephatrine/nxbuilder:golang AS builder -ARG GOPATH="/usr" ARG BUILDTAGS="include_oss include_gcs" ARG REGISTRY_VERSION=main ARG REGCLIENT_VERSION=releases/0.4 -RUN mkdir -p /usr/src/github.com/distribution \ - && git -C /usr/src/github.com/distribution clone -b "$REGISTRY_VERSION" --single-branch --depth=1 https://github.com/distribution/distribution.git -RUN git -C /usr/src clone -b "$REGCLIENT_VERSION" --single-branch --depth=1 https://github.com/regclient/regclient.git +RUN git -C ${HOME} clone -b "$REGISTRY_VERSION" --single-branch --depth=1 https://github.com/distribution/distribution.git +RUN git -C ${HOME} clone -b "$REGCLIENT_VERSION" --single-branch --depth=1 https://github.com/regclient/regclient.git RUN echo "====== COMPILE REGISTRY ======" \ - && cd /usr/src/github.com/distribution/distribution \ - && go build -trimpath -ldflags "-s -w" -o /usr/bin/registry ./cmd/registry + && cd ${HOME}/distribution && go build -trimpath -ldflags "-s -w" -o /usr/bin/registry ./cmd/registry RUN echo "====== COMPILE REGCLIENT ======" \ - && cd /usr/src/regclient \ - && make binaries -j4 + && cd ${HOME}/regclient && make binaries -j4 FROM nephatrine/alpine-s6:latest LABEL maintainer="Daniel Wolf " RUN mkdir /etc/registry COPY --from=builder /usr/bin/registry /usr/bin/registry -COPY --from=builder /usr/src/regclient/bin/ /usr/local/bin/ -COPY --from=builder /usr/src/github.com/distribution/distribution/cmd/registry/config-example.yml /etc/registry/config-example.yml +COPY --from=builder /root/regclient/bin/ /usr/local/bin/ +COPY --from=builder /root/distribution/cmd/registry/config-example.yml /etc/registry/config-example.yml COPY override / RUN echo "====== CONFIGURE REGISTRY ======" \