]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Dockerfile: Optimize pip installs
authorZack Cerza <zack@redhat.com>
Tue, 12 Apr 2022 23:22:54 +0000 (17:22 -0600)
committerZack Cerza <zack@cerza.org>
Wed, 27 Apr 2022 20:51:10 +0000 (14:51 -0600)
With this change, we can avoid rerunning bootstrap on build if
requirements.txt hasn't changed. Build times after non-requirements
changes go from 3-5min to ~2s.

Signed-off-by: Zack Cerza <zack@redhat.com>
docs/docker-compose/teuthology/Dockerfile

index b65e916c65729a1a526aacde42cd06385d876ebe..5587489d17ef9cc62f87bc8524e542ba0280d321 100644 (file)
@@ -18,23 +18,26 @@ RUN apt-get update && \
     lsb-release && \
     apt-get clean all
 WORKDIR /teuthology
-COPY . /teuthology
+COPY requirements.txt bootstrap /teuthology/
 RUN \
     cd /teuthology && \
     mkdir ../archive_dir && \
     mkdir log && \
     chmod +x /teuthology/bootstrap && \
+    PIP_INSTALL_FLAGS="-r requirements.txt" ./bootstrap
+COPY . /teuthology
+RUN \
     ./bootstrap
 COPY docs/docker-compose/teuthology/containerized_node.yaml /teuthology
 COPY docs/docker-compose/teuthology/.teuthology.yaml /root
+COPY docs/docker-compose/teuthology/teuthology.sh /
+RUN mkdir -p /etc/ansible
+COPY docs/docker-compose/teuthology/ansible_inventory/hosts /etc/ansible/
+COPY docs/docker-compose/teuthology/ansible_inventory/secrets /etc/ansible/
 RUN \
     mkdir $HOME/.ssh && \
     touch $HOME/.ssh/${SSH_PRIVKEY_FILE} && \
     chmod 600 $HOME/.ssh/${SSH_PRIVKEY_FILE} && \
     echo "StrictHostKeyChecking=no" > $HOME/.ssh/config && \
     echo "UserKnownHostsFile=/dev/null" >> $HOME/.ssh/config
-COPY docs/docker-compose/teuthology/teuthology.sh /
-RUN mkdir -p /etc/ansible
-COPY docs/docker-compose/teuthology/ansible_inventory/hosts /etc/ansible/
-COPY docs/docker-compose/teuthology/ansible_inventory/secrets /etc/ansible/
 ENTRYPOINT /teuthology.sh
\ No newline at end of file