This is a minimal Python image based on Wolfi.
While this image is being developed, we will stick to the latest stable Python version. Supported versions in the long term are TBD.
We have two images available: a python:latest-dev variant that contains pip and a shell, and a minimal runtime image that just contains
These images are available on cgr.dev:
docker pull cgr.dev/chainguard/python:latest
docker pull cgr.dev/chainguard/python:latest-dev
The python image can be used directly for simple cases, or with a multi-stage build using python-dev as the build container.
FROM cgr.dev/chainguard/python:latest-dev as builder
COPY requirements.txt .
RUN pip install -r requirements.txt --user
# Make sure you update Python version in path
COPY --from=builder /home/nonroot/.local/lib/python3.11/site-packages /home/nonroot/.local/lib/python3.11/site-packages
COPY main.py .
ENTRYPOINT [ "python", "/app/main.py" ]