Skip to content

Install Docker Python packages in an isolated venv#1001

Open
dicnunz wants to merge 1 commit into
AlexsLemonade:masterfrom
dicnunz:docker-python-venv-install
Open

Install Docker Python packages in an isolated venv#1001
dicnunz wants to merge 1 commit into
AlexsLemonade:masterfrom
dicnunz:docker-python-venv-install

Conversation

@dicnunz
Copy link
Copy Markdown

@dicnunz dicnunz commented May 20, 2026

Summary

  • install Docker Python dependencies into /opt/training-modules-python instead of the system interpreter
  • expose that environment through VIRTUAL_ENV and PATH for all later Dockerfile steps and container users
  • add python3-venv so the image can create the environment without --break-system-packages

Closes #885.

Verification

  • git diff --check
  • docker buildx build --check .
  • python3 -m venv /tmp/training-modules-venv-check && /tmp/training-modules-venv-check/bin/python -m pip --version && rm -rf /tmp/training-modules-venv-check

Note: I did not run a full Docker build locally because this image compiles/downloads the full workshop stack. The Dockerfile static build check passes and covers Dockerfile parsing/build checks.

@dicnunz
Copy link
Copy Markdown
Author

dicnunz commented May 20, 2026

Small paid-fix note: if this closes the Docker Python packaging issue and saves maintainer time, I am asking $10 here: https://nicdunz.gumroad.com/l/slop-kill-pass?wanted=true

No issue if this repo only handles volunteer contributions; the PR is intended to stand on its own.

@dicnunz dicnunz force-pushed the docker-python-venv-install branch from 191337d to b272c88 Compare May 22, 2026 04:45
@dicnunz
Copy link
Copy Markdown
Author

dicnunz commented May 22, 2026

Rebased this onto current master (b614eaf) and force-pushed head b272c88.

The PR diff is still limited to the Dockerfile Python package install path:

  • install python3-venv
  • create /opt/training-modules-python
  • put that venv on PATH
  • install requirements.txt inside the venv instead of using --break-system-packages

Validation after rebase:

  • git diff --check origin/master..HEAD

I did not rerun a full Docker build locally because that is heavier than this branch-only refresh, but the rebased diff is unchanged in scope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update how we install Python packages in Docker

1 participant