Dockerfiles: COPY code after installing packages

This change moves COPY directive in kuryr-controller.Dockerfile to be
executed after all the required packages are installed through yum. With
it a layer with all the packages installed can be reused when rebuilding
the image with only Kuryr code changes. This makes development easier
and faster as `yum install` is the longest process during building the
docker image.

Change-Id: I94a7401e393d9c8e51ab50967de792aeae15f811
This commit is contained in:
Michał Dulko 2018-02-15 18:33:22 +01:00
parent ef641766d2
commit 3783e26936
1 changed files with 5 additions and 4 deletions

View File

@ -3,12 +3,13 @@ LABEL authors="Antoni Segura Puimedon<toni@kuryr.org>, Vikas Choudhary<vichoudh@
ARG UPPER_CONSTRAINTS_FILE="https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt"
COPY . /opt/kuryr-kubernetes
RUN yum install -y epel-release \
&& yum install -y --setopt=tsflags=nodocs python-pip \
&& yum install --setopt=tsflags=nodocs --assumeyes inet-tools gcc python-devel wget git \
&& cd /opt/kuryr-kubernetes \
&& yum install --setopt=tsflags=nodocs --assumeyes inet-tools gcc python-devel wget git
COPY . /opt/kuryr-kubernetes
RUN cd /opt/kuryr-kubernetes \
&& pip install -c $UPPER_CONSTRAINTS_FILE --no-cache-dir . \
&& rm -fr .git \
&& yum -y history undo last \