flywheel/python
Python base image for Flywheel projects, coming with
flywheel:flywheel
user - just set USER flywheel
in the last layer/var/metrics
folder for storing multiprocessing metrics - just set
ENV PROMETHEUS_MULTIPROC_DIR=/var/metrics
aria2
- fast downloaderbash
- recommended shell for scriptsbusybox
- unix toolkit (ps
, ping
, etc.)fd
- faster and better find
jo
- emit json from cli argsjq
- json manipulationmicro
- dev-friendly text editorrg
- faster and better grep
sd
- faster and better sed
templar
- jinja2-style template cliuv
- faster and better pip
watchexec
- live reloaderxh
- secure and dev-friendly curl
yq
- yaml manipulationzstd
- fast, lossless compression alg-build
variant contains git
and ssh
CI pipelines on the main
branch push the following tagging scheme to
DockerHub:
flywheel/python:{PYTHON_VER}-{BASE_IMAGE}
- the recommended prod base imageflywheel/python:{PYTHON_VER}-{BASE_IMAGE}-build
- build variant with git
and ssh
Available PYTHON_VER
s: 3.12
(default), 3.11
, 3.10
, 3.9
Available BASE_IMAGE
s: alpine
(default), debian
(bookworm)
The default 3.12-alpine
is also tagged as latest
, e.g.:
flywheel/python:latest
=== :3.12-alpine
flywheel/python:build
=== :3.12-alpine-build
Commit-specific tags are available for improved reproducibility, e.g.:
flywheel/python:3.12-debian-d34db33f
Create a .dockerignore
to keep the context limited to the files added:
# exclude everything
**
# include files needed
!myproj
!pyproject.toml
!README.md
!requirements.txt
# re-exclude cruft
**/__pycache__
Create a Dockerfile
:
FROM flywheel/python:3.12-alpine AS base
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
WORKDIR /src
COPY requirements.txt ./
RUN uv pip install -rrequirements.txt
CMD ["my-app"]
EXPOSE 8000
FROM base AS dev
COPY requirements-dev.txt ./
RUN uv pip install -rrequirements-dev.txt
COPY . .
RUN python -m compileall -bqj0 . && \
fd -epy -E__init__.py -xrm . && \
uv pip install --no-deps -e.
FROM base AS prod
COPY --from=dev /src .
RUN uv pip install --no-deps -e.
USER flywheel
docker pull flywheel/python