Image Overview: python

Overview: python Chainguard Image

Minimal Python image based on Wolfi.

Download this Image

The image is available on cgr.dev:

docker pull cgr.dev/chainguard/python:latest

Variants

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.12/site-packages /home/nonroot/.local/lib/python3.12/site-packages

COPY main.py .

ENTRYPOINT [ "python", "/app/main.py" ]

Last updated: 2024-02-16 00:30