Docker Image With Multiple Python Installs

Not sure whether this has been done before but I created a docker container with four (4) Python installs. To get there I heavily abused Docker multistage builds from external images. You can check out the repo for the gory details. Now I'm not insane there is a specific reason why I did this.

I'm pretty all in on Visual Studio Code dev containers and I also like having sensible CI pipelines to catch things. I recently wrote a little library that I diligently tested against multiple python versions using tox. I like to be able to test and debug this locally and not rely on the pipeline specific syntax. So the challenge was to create an environment locally and in the pipeline where a single tox command would kick start all my tests. This seems to be the solution that satisfies this criteria.

Here's an example using Github Actions:

name: tests
on: push

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: lukewiwa/pythons:latest
    steps:
      - name: tox
        run: tox

And one for bitbucket pipelines:

image: lukewiwa/pythons

pipelines:
  default:
    - step:
        script:
            - tox