From fc2a3f94a790c71625092a70b2ae4c758ab64b1d Mon Sep 17 00:00:00 2001 From: Nicolas Braud-Santoni Date: Thu, 25 Apr 2019 17:33:28 -0400 Subject: [PATCH] CI: Hardcode pip requirements into the Dockerfiles Pro: Works around an issue with the way Cirrus caches containers: https://github.com/cirruslabs/cirrus-ci-docs/issues/273 Con: - Requires regenerating/recommiting Dockerfiles whenever requirements change. - This will break if the character `'` is used in requirements*.txt --- .ci/dockerfiles/generate.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.ci/dockerfiles/generate.sh b/.ci/dockerfiles/generate.sh index 38e3d93b..875a1367 100755 --- a/.ci/dockerfiles/generate.sh +++ b/.ci/dockerfiles/generate.sh @@ -31,8 +31,12 @@ function template() { preinstall="$1"; shift PIP="$(py $image) -m pip install --upgrade-strategy eager -U" CMDS=() - for requirement in "$@" requirements.txt; do - CMDS+=("$PIP -r $requirement") + for requirement in requirements.txt "$@"; do + REQS=() + while read req; do + REQS+=("'$req'") + done < ../../${requirement} + CMDS+=("$PIP ${REQS[*]}") done CMDS+=("$(postinstall $image)") @@ -41,7 +45,6 @@ FROM ${image} ${preinstall} -ADD $@ requirements.txt / $(run $image "${CMDS[@]}") EOF }