Skip to content

Instantly share code, notes, and snippets.

@cfm
Last active July 14, 2022 01:00
Show Gist options
  • Save cfm/d3240bf607632ee99e12722e2ae13844 to your computer and use it in GitHub Desktop.
Save cfm/d3240bf607632ee99e12722e2ae13844 to your computer and use it in GitHub Desktop.

Setup

$ docker build -f python3.7.Dockerfile -t sddp-350-py3.7 .
$ docker build -f python3.9.Dockerfile -t sddp-350-py3.9 .

Expected results

Command Python Result
docker run sddp-350-py3.9 3.9
docker run sddp-350-py3.7 3.7
docker run -e PIP_CONSTRAINT=constraints.txt sddbp-350-py3.7 3.7
FROM python:3.7-alpine
COPY ./constraints.txt ./
COPY ./test ./
ENTRYPOINT ./test
FROM python:3.9-alpine
COPY ./constraints.txt ./
COPY ./test ./
ENTRYPOINT ./test
#!/bin/sh
set -eux -o pipefail
python3 -m venv .venv
. .venv/bin/activate
FLAGS="--no-binary :all: --constraint constraints.txt --requirement constraints.txt"
# Defensively pin prerequisites.
pip install $FLAGS
# If we succeed, install what we actually care about.
pip install $FLAGS python-dateutil==2.7.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment