containers

Pyvorin Docker Best Practices

Multi-stage builds, cache layers, and image size.

Published May 30, 2026

Multi-Stage Build

FROM python:3.12 as compiler
RUN pip install pyvorin-thin
COPY . /app
WORKDIR /app
RUN pyvorin compile app.py --function main

FROM python:3.12-slim
COPY --from=compiler /app /app
COPY --from=compiler /root/.pyvorin/cache /root/.pyvorin/cache

Cache Layer

Pre-compile during build so runtime needs no compiler.

Image Size

Use slim or alpine final images. Compiled artifacts are small .so files.