diff --git a/extensions/Dockerfile b/extensions/Dockerfile index 68370cfb..51d21f7b 100644 --- a/extensions/Dockerfile +++ b/extensions/Dockerfile @@ -1,9 +1,3 @@ -## Builds the webserver for the repo service. -FROM golang as gobuild -ADD repo-server/main.go . -RUN mkdir /build -RUN go build -o /build/webserver main.go - ## Downloads the extensions given the extensions.yaml ARG RHCOS_VERSION=latest FROM registry.ci.openshift.org/rhcos-devel/rhel-coreos:${RHCOS_VERSION} as os @@ -11,15 +5,19 @@ FROM registry.ci.openshift.org/rhcos-devel/rhel-coreos:${RHCOS_VERSION} as os RUN rpm-ostree compose extensions --rootfs=/ --output-dir=/usr/share/rpm-ostree/extensions/ {manifest,extensions}.yaml ## Creates the repo metadata for the extensions -FROM quay.io/centos/centos:stream8 as repo +FROM quay.io/centos/centos:stream8 as builder COPY --from=os /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/ -RUN dnf install -y createrepo_c +RUN dnf install -y createrepo_c golang +ADD repo-server/main.go . +RUN mkdir /build +RUN go build -o /build/webserver main.go + RUN createrepo_c /usr/share/rpm-ostree/extensions/ ## Final container that has the extensions and webserver FROM registry.access.redhat.com/ubi8/ubi:latest -COPY --from=gobuild /build/webserver /usr/bin/webserver -COPY --from=repo /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/ +COPY --from=builder /build/webserver /usr/bin/webserver +COPY --from=builder /usr/share/rpm-ostree/extensions/ /usr/share/rpm-ostree/extensions/ CMD ["./usr/bin/webserver"] EXPOSE 9666/tcp