Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Hardcode pip requirements into the Dockerfiles #240

Open
wants to merge 9 commits into
base: canon
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .ci/dockerfiles/docs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ RUN apt update || true && \
apt install -qq -y make && \
rm -rf /var/cache/apt/*

ADD requirements-docs.txt requirements.txt /
RUN python3 -m pip install --upgrade-strategy eager -U -r requirements-docs.txt && \
python3 -m pip install --upgrade-strategy eager -U -r requirements.txt && \
RUN python3 -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < "3.7"' && \
python3 -m pip install --upgrade-strategy eager -U 'sphinx' 'sphinx_rtd_theme' && \
rm -rf ~/.cache/pip
15 changes: 12 additions & 3 deletions .ci/dockerfiles/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,18 @@ 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
case "$image" in
*:*-windowsservercore-*)
REQS+=("'${req//\"/\`\"}'") ;;
*)
REQS+=("'$req'") ;;
esac
done < ../../${requirement}

CMDS+=("$PIP ${REQS[*]}")
done
CMDS+=("$(postinstall $image)")

Expand All @@ -41,7 +51,6 @@ FROM ${image}

${preinstall}

ADD $@ requirements.txt /
$(run $image "${CMDS[@]}")
EOF
}
Expand Down
5 changes: 2 additions & 3 deletions .ci/dockerfiles/pypy_3.6-slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ RUN apt update || true && \
apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc && \
rm -rf /var/cache/apt/*

ADD requirements-tests.txt requirements.txt /
RUN pypy3 -m pip install --upgrade-strategy eager -U -r requirements-tests.txt && \
pypy3 -m pip install --upgrade-strategy eager -U -r requirements.txt && \
RUN pypy3 -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < "3.7"' && \
pypy3 -m pip install --upgrade-strategy eager -U 'pytest' && \
rm -rf ~/.cache/pip
5 changes: 2 additions & 3 deletions .ci/dockerfiles/python_3.6-slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM python:3.6-slim



ADD requirements-tests.txt requirements.txt /
RUN python3 -m pip install --upgrade-strategy eager -U -r requirements-tests.txt && \
python3 -m pip install --upgrade-strategy eager -U -r requirements.txt && \
RUN python3 -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < "3.7"' && \
python3 -m pip install --upgrade-strategy eager -U 'pytest' && \
rm -rf ~/.cache/pip
5 changes: 2 additions & 3 deletions .ci/dockerfiles/python_3.6-windowsservercore-1809
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM python:3.6-windowsservercore-1809



ADD requirements-tests.txt requirements.txt /
RUN ( C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements-tests.txt ) -and \
( C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements.txt ) -and \
RUN ( C:\Python\python.exe -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < `"3.7`"' ) -and \
( C:\Python\python.exe -m pip install --upgrade-strategy eager -U 'pytest' ) -and \
( Remove-Item –path %LOCALAPPDATA%\pip\Cache -recurse -ErrorAction Ignore )
5 changes: 2 additions & 3 deletions .ci/dockerfiles/python_3.7-slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM python:3.7-slim



ADD requirements-tests.txt requirements.txt /
RUN python3 -m pip install --upgrade-strategy eager -U -r requirements-tests.txt && \
python3 -m pip install --upgrade-strategy eager -U -r requirements.txt && \
RUN python3 -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < "3.7"' && \
python3 -m pip install --upgrade-strategy eager -U 'pytest' && \
rm -rf ~/.cache/pip
5 changes: 2 additions & 3 deletions .ci/dockerfiles/python_3.7-windowsservercore-1809
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM python:3.7-windowsservercore-1809



ADD requirements-tests.txt requirements.txt /
RUN ( C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements-tests.txt ) -and \
( C:\Python\python.exe -m pip install --upgrade-strategy eager -U -r requirements.txt ) -and \
RUN ( C:\Python\python.exe -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < `"3.7`"' ) -and \
( C:\Python\python.exe -m pip install --upgrade-strategy eager -U 'pytest' ) -and \
( Remove-Item –path %LOCALAPPDATA%\pip\Cache -recurse -ErrorAction Ignore )
5 changes: 2 additions & 3 deletions .ci/dockerfiles/python_3.8-rc-slim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ RUN apt update || true && \
apt install -qq -y pkgconf libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev gcc && \
rm -rf /var/cache/apt/*

ADD requirements-tests.txt requirements.txt /
RUN python3 -m pip install --upgrade-strategy eager -U -r requirements-tests.txt && \
python3 -m pip install --upgrade-strategy eager -U -r requirements.txt && \
RUN python3 -m pip install --upgrade-strategy eager -U 'pygame' 'ppb-vector' 'dataclasses; python_version < "3.7"' && \
python3 -m pip install --upgrade-strategy eager -U 'pytest' && \
rm -rf ~/.cache/pip
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ docs_task:
container:
dockerfile: .ci/dockerfiles/docs

install_script: pip install -e .
install_script: pip install .
script: make -C docs/ html


Expand Down