python-multi
Dockerfile
This is a single purpose repository intended to provide a Dockerfile for an image with multiple Python versions installed.
The Dockerfile uses pyenv
to install the included Python versions.
The "Short Description" on Docker Hub should read:
Multiple Python versions and tox installed into Ubuntu LTS 20.04
This is provided here as a back-up (i.e. in case the short description is overwritten).
This is a collection of useful docker
commands relevant to
this directory. Some of them are just generic docker
commands
for making sure the local system is in a good state (useful
for those who don't use docker
on a regular basis).
$ docker build \
> --file src/Dockerfile \
> --tag <username>/python-multi:latest \
> .
$ docker run \
> --rm \
> --tty \
> --interactive \
> --volume $(git rev-parse --show-toplevel):/var/code/ \
> <username>/python-multi:latest \
> /bin/bash
You can pull my builds from one of two repositories
- Github Container Repository: ghcr.io/qs5779/python-multi
- Dockerhub Repository: qs5779/python-multi
Tags:
- edge (most recent unreleased build, use with caution)
- latest (most recent released build)
- YYYYmmdd (tagged when a release is made)
$ docker run \
> --rm \
> --tty \
> --interactive \
> --volume $(git rev-parse --show-toplevel):/var/code/ \
> <repository>/<tag> \
> /bin/bash
$ docker system prune # Clean-up
$ docker image prune # Clean-up
$ docker container ls # Running containers
$ docker images # List installed/cached images
$ docker image rm ${IMAGE_ID}
$ docker image rm ${REPOSITORY}:${TAG}
Assuming you have run the container from your python project directory
# at the bash prompt you should be able to cd /var/code
# and run your tests, simplest command is:
$ cd /var/code
$ tox
forked from https://github.com/jeverling/python-multi which was forked from https://github.com/dhermes/python-multi
I needed tox and python3.10 which was provided by the jeverling fork. I created this fork as I'll hopefull keep the python versions updatef as new ones are released and I am using the oportunity to improve my knowlege of github actions. To automatically build, test and push the image when triggered.