Adds a Python venv to the generated Docker image of a release. Useful when an Elixir release shells out to Python tools (data science libraries, CLI tools, ML inference, etc.) and you want them available inside the container with a reproducible set of pinned packages.
Optional. Enable by listing Marea.Plugins.Docker.Python under
plugins: in marea.yaml (the module-name spelling of docker.python).
Pulls in Marea.Plugins.Docker transitively. No CLI commands of its
own — the plugin only contributes a schema field and hooks into the
Dockerfile-rendering chain.
Schema contributions
deploys.<d>.releases.<r>.docker.python:— release-level Python config, nested inside the Docker plugin'sdocker:block.
| Field | Type | Notes |
|---|---|---|
version | string | Python version label (currently informational; the venv uses whatever python3 is in the Alpine builder). |
requirements | list of strings | Package specifiers passed to uv pip install. Each entry is one specifier (e.g. "requests==2.31.0", "flask>=3.0"). |
How the venv gets into the image
docker.python implements
Marea.Plugins.Docker.marea_dockerfile_assigns/2, the hook
Marea.Plugins.Docker runs before rendering the Dockerfile. When the
active release has a docker.python: block, the plugin appends two
fragments to the assigns:
:extra_stagesgets a newpython-builderAlpine stage that installspython3, downloadsuvas a static binary, runsuv venv /opt/venv --python python3, anduv pip installs therequirements.:extra_app_stepsgets aCOPY --from=python-builder /opt/venv /opt/venvplus anapk add --no-cache python3and achown -R appinside the final app stage.
The built-in Dockerfile template
(priv/templates/docker/dockerfile_v01.eex)
expands those extension points; project-local templates that override
the default need to do the same if they want Python support to keep
working. See docker.md for the
extension-point contract.
Example
plugins:
- Marea.Plugins.Helm # pulls in Docker + Build via plugin_deps
- Marea.Plugins.Docker.Python # pulls in Docker via plugin_deps
deploys:
staging:
helm:
namespace: my-app-staging
releases:
api:
helm:
template: deployment.yaml
docker:
python:
requirements:
- "requests==2.31.0"
- "flask>=3.0"marea build show-dockerfile --deploy staging --release api shows
the Python build stage and app-stage venv copy injected into the
default Dockerfile.