Last active
October 7, 2022 14:31
-
-
Save dmc5179/1e99e9ba5fa6130654add81c813b3a39 to your computer and use it in GitHub Desktop.
Dockerfile to build Docker registry on RHEL UBI Images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM registry.redhat.io/ubi8/go-toolset:latest AS build | |
ENV DISTRIBUTION_DIR /opt/app-root/src/go/src/github.com/docker/distribution | |
ENV BUILDTAGS include_oss include_gcs | |
ENV GOPATH /opt/app-root/src/go | |
ENV GOBIN /usr/lib/golang/bin | |
ARG GOOS=linux | |
ARG GOARCH=s390x | |
#ARG GOARM=6 | |
WORKDIR $DISTRIBUTION_DIR | |
COPY . $DISTRIBUTION_DIR | |
USER root | |
RUN chown -R default.root /opt/app-root/src/go | |
USER default | |
RUN go get -v . \ | |
&& CGO_ENABLED=0 make PREFIX=/opt/app-root/src/go clean binaries && file ./bin/registry | grep "statically linked" | |
FROM registry.redhat.io/ubi8/ubi-minimal:latest | |
USER root | |
RUN microdnf clean all \ | |
&& microdnf -y update \ | |
&& microdnf clean all \ | |
&& rm -rf /var/cache/dnf | |
COPY cmd/registry/config-dev.yml /etc/docker/registry/config.yml | |
COPY --from=build /opt/app-root/src/go/src/github.com/docker/distribution/bin/registry /bin/registry | |
#USER default | |
VOLUME ["/var/lib/registry"] | |
EXPOSE 5000 | |
ENTRYPOINT ["registry"] | |
CMD ["serve", "/etc/docker/registry/config.yml"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To build:
Note that this image is based on the UBI images from Red Hat. This should support platforms like s390x