Sign inSign up

carrycat/rpi-zero-python

By carrycat

Updated over 2 years ago

Python Alpine for Raspberry Pi Zero Only [arm32/v6]

Image
Internet of things
0

91

carrycat/rpi-zero-python repository overview

Python Alpine for Raspberry Pi Zero Only (arm32v6)

Purpose: save time by avoiding the need to rebuild and recompile dependencies on arm32v6 each time.

The image is based on arm32v6/python:alpine with minimal packages installed, including poetry.

Usage:
  1. .Build the environment image for export to the main project Dockerfile.
#venv.Dockerfile 
FROM carrycat/rpi-zero-python:3.11-alpine AS builder
COPY poetry.lock pyproject.toml ./
ARG DEBUG=false
#RUN poetry source add --priority=primary pi https://www.piwheels.org/simple
#RUN poetry source add --priority=primary PyPI
#RUN poetry run pip install RPi.GPIO==0.7.1 --extra-index-url https://www.piwheels.org/simple
RUN poetry install --no-root --only main$(if [ "$DEBUG" = 'true' ]; then echo ',dev'; fi)
  1. Then, in the main project Dockerfile, import the venv image.
#porject.Dockerfile
FROM arm32v6/python:3.11-alpine AS runner
ENV PYTHONUNBUFFERED=1
ENV ENV_PATH=/app/.venv
WORKDIR /app
ENV PATH "/app/.venv/bin:${PATH}"
COPY --from=username/venv $ENV_PATH /app/.venv
.#...

Tag summary

Content type

Image

Digest

sha256:b04ba0e1c

Size

84.2 MB

Last updated

over 2 years ago

docker pull carrycat/rpi-zero-python:3.11-alpine