Squash some RUN layers in Dockerfile

This will reduce the number of layers in the final image.

Change-Id: I1102af5aa98df33d1454964955d0f2c13ee39907
This commit is contained in:
James E. Blair 2020-12-11 10:10:43 -08:00
parent f3e8c809dc
commit f42604a8d9
1 changed files with 9 additions and 9 deletions

View File

@ -39,9 +39,11 @@ RUN assemble
# installations do so we have to call zuul-manage-ansible here. Remove # installations do so we have to call zuul-manage-ansible here. Remove
# /root/.local/share/virtualenv after because it adds wheels into /root # /root/.local/share/virtualenv after because it adds wheels into /root
# that we don't need after the install step so are a waste of space. # that we don't need after the install step so are a waste of space.
RUN /output/install-from-bindep && zuul-manage-ansible && rm -rf /root/.local/share/virtualenv RUN /output/install-from-bindep \
&& zuul-manage-ansible \
RUN mkdir /tmp/openshift-install \ && rm -rf /root/.local/share/virtualenv \
# Install openshift
&& mkdir /tmp/openshift-install \
&& curl -L $OPENSHIFT_URL -o /tmp/openshift-install/openshift-client.tgz \ && curl -L $OPENSHIFT_URL -o /tmp/openshift-install/openshift-client.tgz \
&& cd /tmp/openshift-install/ \ && cd /tmp/openshift-install/ \
&& echo $OPENSHIFT_SHA /tmp/openshift-install/openshift-client.tgz | sha256sum --check \ && echo $OPENSHIFT_SHA /tmp/openshift-install/openshift-client.tgz | sha256sum --check \
@ -52,13 +54,12 @@ ENV DEBIAN_FRONTEND=noninteractive
COPY --from=builder /output/ /output COPY --from=builder /output/ /output
RUN /output/install-from-bindep zuul_base \ RUN /output/install-from-bindep zuul_base \
&& rm -rf /output && rm -rf /output \
RUN useradd -u 10001 -m -d /var/lib/zuul -c "Zuul Daemon" zuul && useradd -u 10001 -m -d /var/lib/zuul -c "Zuul Daemon" zuul \
# This enables git protocol v2 which is more efficient at negotiating # This enables git protocol v2 which is more efficient at negotiating
# refs. This can be removed after the images are built with git 2.26 # refs. This can be removed after the images are built with git 2.26
# where it becomes the default. # where it becomes the default.
RUN git config --system protocol.version 2 && git config --system protocol.version 2
VOLUME /var/lib/zuul VOLUME /var/lib/zuul
CMD ["/usr/local/bin/zuul"] CMD ["/usr/local/bin/zuul"]
@ -73,8 +74,7 @@ COPY --from=builder /tmp/openshift-install/oc /usr/local/bin/oc
COPY tools/4D64390375060AA4.asc /etc/apt/trusted.gpg.d/kubic.asc COPY tools/4D64390375060AA4.asc /etc/apt/trusted.gpg.d/kubic.asc
RUN echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \ RUN echo 'deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list \
&& apt-get update \ && apt-get update \
&& apt-get install -y \ && apt-get install -y skopeo \
skopeo \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*