Skip to content

Commit

Permalink
CI: Hardcode pip requirements into the Dockerfiles
Browse files Browse the repository at this point in the history
Pro: Works around an issue with the way Cirrus caches containers:
     cirruslabs/cirrus-ci-docs#273

Con:
- Requires regenerating/recommiting Dockerfiles whenever requirements change.
- This will break if the character `'` is used in requirements*.txt
  • Loading branch information
nbraud committed Apr 25, 2019
1 parent 9501517 commit fc2a3f9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .ci/dockerfiles/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")

Expand All @@ -41,7 +45,6 @@ FROM ${image}
${preinstall}
ADD $@ requirements.txt /
$(run $image "${CMDS[@]}")
EOF
}
Expand Down

0 comments on commit fc2a3f9

Please sign in to comment.