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

provide Docker packaging #1035

Open
gaborbernat opened this issue Oct 5, 2018 · 11 comments
Open

provide Docker packaging #1035

gaborbernat opened this issue Oct 5, 2018 · 11 comments
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. level:hard rought estimate that this might be quite hard to implement

Comments

@gaborbernat
Copy link
Member

Beside providing tox as a Python package it could be helpful to also provide an "official" Docker image that's set up with correct Pythons and tox installed. This came out of #943. Any version of this needs to:

  • automate docker image update as part of the release process (Azure Pipelines has docker support),
  • add image files,
  • add tests (Azure Pipelines has docker support).

It's to be determined if this should leave as part of this repository; or should it instead be a separate project.

@gaborbernat gaborbernat mentioned this issue Oct 5, 2018
6 tasks
@gaborbernat gaborbernat changed the title Docker support provide Docker packaging Oct 5, 2018
@gaborbernat gaborbernat added level:hard rought estimate that this might be quite hard to implement help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. labels Oct 5, 2018
@gaborbernat gaborbernat added this to the 4.0 milestone Oct 5, 2018
@obestwalter
Copy link
Member

Who would be the intended audience for this?

@gaborbernat
Copy link
Member Author

gaborbernat commented Jan 8, 2019

People not wanting to install python/tox on their machine, but would prefer to invoke it from tox; think of it as instead of tox you could just do docker run tox:latest -v .:/w. The second option has no setup cost given you already have docker up and running. I would now see it as part of tox-dev organization, but under a different repo hooked up against the docker cloud. It would repackage the latest version from PyPi after every tox release.

@obestwalter
Copy link
Member

obestwalter commented Jan 8, 2019

That sounds indeed handy.

@thenewguy
Copy link

Did anything ever come of this?

@thenewguy
Copy link

Sounds like something that would be accepted to the official docker library as well https://docs.docker.com/docker-hub/official_images/#creating-an-official-image

@gaborbernat gaborbernat modified the milestones: 4.0, 4.1 Jan 31, 2021
@gaborbernat
Copy link
Member Author

Would be great if someone could make a contribution for this.

@31z4
Copy link
Contributor

31z4 commented Jan 30, 2023

Hi guys, I'm happy to share an initial version of my Docker image packaging for tox 😊

This multi-arch Docker image neatly packages tox v4 along with all currently active Python versions. The image is secure, compact, and easy to use.

At this moment, the image only supports the following platforms:

  • linux/arm64/v8
  • linux/amd64

Please give it a try and share your feedback 🙏

I'm especially interested in discussing current image limitations and would love to hear from maintainers and users about the following:

  • tox v3 is not supported. Does it make sense to have the v3 version of the image? For how long v3 will be maintained?
  • It is not possible to install additional Python versions into a running container because the image doesn't include any build dependencies. I thought that for most cases it would be sufficient to have active CPython versions installed. Otherwise, it should be possible to build a custom image based on 31z4/tox.
  • For the same reason as above testing Python code that requires building C extensions is not supported.

As for the official Docker image, I could help with that too. I've been maintaining official images for Zookeeper and Storm since 2016, so I have some relevant experience ☺️ Although, before contributing to the official docker library I'd love to gather some feedback from the community about the current version, fix discovered issues and address limitations if needed.

@jugmac00
Copy link
Member

toy v3 is no longer officially supported by the tox core team. So imho there is need for a docker image.

@31z4
Copy link
Contributor

31z4 commented Jan 31, 2023

I moved from compiling Python using pyenv to installing from deadsnakes PPA 🎉 Not only it drastically reduced build times, but also resulted in a smaller image (321MB vs 387MB). I realized that compiling Python is out of scope of building a Docker image for tox.

Everybody who is interested, please check the latest image tag.

@n1ngu
Copy link

n1ngu commented Feb 1, 2023

I think a tox docker image should provide similar tags to the official python image tags. At least latest,slim,alpine and maybe the -buster,-bullseye families too. This way users of this image can pick what they need. I'd expect slim to be slim, but I'd be surely using the most bloated latest tag to run a CI: if I am not packaging an application in the image I won't care about the image size.

I'd rather opt for an image that can build most source distributions out-of-the-box, provided it features git, mercurial and a bunch of preinstalled development libraries (namely CPython headers) just as the python:latest does.

As for the vendored python interpreters, I think settling for the active python versions is a sensible default but I would expect

  • active pypy versions be included as well!
  • an easy mechanism to extend the tox image with additional interpreters like legacy CPythons, development CPythons (alphas, betas and RCs but also locally modified/hacked interpreters) and other Python implementations (Jython, RustPython and whatnot)

@31z4
Copy link
Contributor

31z4 commented Feb 8, 2023

Thanks for your feedback @n1ngu 👍

I think a tox docker image should provide similar tags to the official python image tags. At least latest,slim,alpine and maybe the -buster,-bullseye families too.

I'm not sure about having several image variants right now. Because building and maintaining such variants would require extra effort. But I'm still not sure how popular the image would be. I don't think that absence of the alpine or debian based version will be a blocker for many users.

if I am not packaging an application in the image I won't care about the image size.

Good point.

I'd rather opt for an image that can build most source distributions out-of-the-box.

Makes sense. As usability benchmark I took flask and mypy and updated the image so that both packages can be tested using it out-of-the-box. See flask demo.

active pypy versions be included as well!

PyPy is not included at the moment. But maybe I'll add in the future.

an easy mechanism to extend the tox image with additional interpreters

That's doable by creating a derivative image. I added a short example to the README.

@gaborbernat gaborbernat removed this from the P-1 milestone Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. level:hard rought estimate that this might be quite hard to implement
Projects
None yet
Development

No branches or pull requests

6 participants