Sign inSign up

flywheel/python

By flywheel

•Updated about 5 hours ago

Python base images

Image
API management
Data science
0

500K+

flywheel/python repository overview

⁠flywheel/python

Python base image for Flywheel projects, coming with

  • the flywheel:flywheel user - just set USER flywheel in the last layer
  • the /var/metrics folder for storing multiprocessing metrics - just set ENV PROMETHEUS_MULTIPROC_DIR=/var/metrics
  • the following basic utilities for both build- and run-time:
  • in addition, the -build variant contains git and ssh

⁠Tags

CI pipelines on the main branch push the following tagging scheme to DockerHub⁠:

  • flywheel/python:{PYTHON_VER}-{BASE_IMAGE} - the recommended prod base image
  • flywheel/python:{PYTHON_VER}-{BASE_IMAGE}-build - build variant with git and ssh

Available PYTHON_VERs: 3.12 (default), 3.11, 3.10, 3.9
Available BASE_IMAGEs: 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

⁠Usage

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

⁠License

MIT

⁠Repository

flywheel-io/tools/img/python⁠

Tag summary

Content type

Image

Digest

sha256:b78926bc6…

Size

289.5 MB

Last updated

about 5 hours ago

docker pull flywheel/python:build