Skip to content

Multi-arch Docker image packaging for tox. Includes common build dependencies and currently active CPython versions.

Notifications You must be signed in to change notification settings

31z4/tox-docker

Repository files navigation

Docker image packaging for tox

tox is a generic Python virtual environment management and test command line tool. This multi-arch Docker image neatly packages tox v4 along with common build dependencies (e.g., make, gcc, etc) and currently active CPython versions:

  • 3.9
  • 3.10
  • 3.11
  • 3.12
  • 3.13

The image is secure, tested, compact, and easy to use. At this moment, it supports the following platforms:

  • linux/arm64/v8
  • linux/amd64

The following demo shows how to test Flask using out-of-the box Docker image for tox:

tox copy

You can try it yourself by running the following commands:

$ git clone --depth 1 --branch 3.0.0 https://github.com/pallets/flask.git
$ docker run -v `pwd`/flask:/tests -it --rm 31z4/tox run-parallel --skip-env style

Usage

The recommended way of using the image is to mount the directory that contains your tox configuration files and your code as a volume. Assuming your project is within the current directory of the host, use the following command to run tox without any flags:

$ docker run -v `pwd`:/tests -it --rm 31z4/tox

Also, you can easily pass subcommands and flags:

$ docker run -v `pwd`:/tests -it --rm 31z4/tox run-parallel -e black,py312

Note, that the image is configured with a working directory at /tests.

If you want to install additional Python versions/implementations or Ubuntu packages you can create a derivative image. Just make sure you switch the user to root when needed and switch back to tox afterwards:

FROM 31z4/tox

USER root

RUN set -eux; \
    apt-get update; \
    DEBIAN_FRONTEND=noninteractive \
    apt-get install -y --no-install-recommends \
        python3.7; \
    rm -rf /var/lib/apt/lists/*

USER tox

Versioning

Image tags have the form of {tox-version}-{image-version} where image-version part is optional and follows semantic versioning. For example, expect major image version bump on incompatible changes, like removing the Python version which has reached its end-of-life or changing a base image.

For production use, it's recommended to pin both tox and image versions (e.g., 31z4/tox:4.4.5-2.1.1).

License

View license information for tox and Python 3.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

About

Multi-arch Docker image packaging for tox. Includes common build dependencies and currently active CPython versions.

Topics

Resources

Stars

Watchers

Forks