Image Overview: python

Overview: python Chainguard Image

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.

Get It!

We have two images available: a python:latest-dev variant that contains pip and a shell, and a minimal runtime image that just contains python itself.

These images are available on cgr.dev:

docker pull cgr.dev/chainguard/python:latest
docker pull cgr.dev/chainguard/python:latest-dev

Usage

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

WORKDIR /app

COPY requirements.txt .

RUN pip install -r requirements.txt --user

FROM cgr.dev/chainguard/python:latest

WORKDIR /app

# 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" ]