]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Dockerfile: Optimize pip installs dev-mode-wait
authorZack Cerza <zack@redhat.com>
Tue, 12 Apr 2022 23:22:54 +0000 (17:22 -0600)
committerZack Cerza <zack@redhat.com>
Wed, 13 Apr 2022 21:40:49 +0000 (15:40 -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 06fb5a3f8bb4cd75ee4f09504d7699b4fc8c40ff..924aba24a3c486373bf7f456966b96887bebbf03 100644 (file)
@@ -19,23 +19,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 && \
+    VENV=$VENV PIP_INSTALL_FLAGS="-r requirements.txt" ./bootstrap
+COPY . /teuthology
+RUN \
     VENV=$VENV ./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