[Docker] Simplify and modernize Dockerfile#3290
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the Docker build setup by consolidating multiple Dockerfiles into a single multi-stage docker/Dockerfile, replacing the legacy docker/build.sh matrix with a CI-friendly docker buildx bake configuration, and relocating the deeplabcut-docker helper package into docker/package/.
Changes:
- Replace
Dockerfile.base/core/jupyter/testwith a single multi-stagedocker/Dockerfile(core/jupyter/test stages). - Add
docker/docker-bake.hclto define reproducible build targets/tags (including optionallatesttags viaMARK_LATEST). - Move/add packaging scaffolding for
deeplabcut-dockerintodocker/package/and update Docker documentation accordingly.
Reviewed changes
Copilot reviewed 10 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docker/package/setup.cfg | Introduces setuptools packaging metadata + console entry point for deeplabcut-docker. |
| docker/package/pyproject.toml | Defines build backend/requirements for the helper package. |
| docker/package/deeplabcut_docker.sh | Adds shell launcher that pulls/builds user-mapped images and runs containers. |
| docker/package/deeplabcut_docker.py | Adds Python CLI wrapper that spawns the shell launcher via a PTY. |
| docker/package/Makefile | Updates README source path for PyPI packaging workflow. |
| docker/package/MANIFEST.in | Ensures package artifacts (README/license/script) are included in builds. |
| docker/package/LICENSE | Adds LGPLv3 license text for the helper package distribution. |
| docker/docker-bake.hcl | Adds buildx bake targets for core + jupyter with versioned and optional latest tags. |
| docker/build.sh | Removes legacy bash build/test/push matrix. |
| docker/README.md | Updates docs for new tags and buildx bake workflow. |
| docker/Dockerfile.test | Removes old dedicated test Dockerfile (replaced by multi-stage Dockerfile). |
| docker/Dockerfile.jupyter | Removes old jupyter Dockerfile (replaced by multi-stage Dockerfile). |
| docker/Dockerfile.core | Removes old core Dockerfile (replaced by multi-stage Dockerfile). |
| docker/Dockerfile.base | Removes old base Dockerfile (replaced by multi-stage Dockerfile). |
| docker/Dockerfile | Adds new multi-stage Dockerfile implementing core/jupyter/test stages. |
| docker/.dockerignore | Adds docker build context ignore rules for a slimmer build context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
C-Achard
left a comment
There was a problem hiding this comment.
Looks great, very nice consolidation !
Most comments below are about changing existing behavior rather than improving the layout, and may have been handled elsewhere; please filter accordingly.
deruyter92
left a comment
There was a problem hiding this comment.
Thanks @C-Achard, see my response below! Mostly accepted all suggestions, thanks for the helpful review!
* update deeplabcut_docker: replace shell script with pure python
* update deeplabcut_docker: modernize setup via pyproject.toml
* update deeplabcut_docker README
* docker: fix default user home directory -> home/{user}
* deeplabcut-docker: update print statement passw->token
* deeplabcut-docker: update pyproject.toml Python range 3.10-3.12
This PR is part 1 of updating the docker setup and only entails the Dockerfiles and how we build them. The
deeplabcut-dockeris also updated, but that is discussed separately in PR #3291 to avoid mixing topics.adresses #3282, #3285
Motivation
latest,latest-jupyterand3.0rc14-core-cuda12.4or similar.cuda12.4is kept as default which should run on basically most machines from the last 5 years (including newer ones thanks to backward compatibility).<cudnn_version>is dropped from the name, since all were using the same.baseis dropped as image version since it is equivalent tocore.cuda 12.1is dropped as default, andcuda11.8will remain on DockerHub to support those with legacy hardware.deeplabcut-dockerpackage (for deeplabcut-docker developers) was not clearly separated. The package is now moved to its own subdirectory.Changes
{version}-core-cuda{CUDA}(no cudnn suffix in bake tags).Not included: