# Optimized Dockerfile for Raspberry Pi Zero (ARMv6) # Using Python 3.12 with Pydantic v2 for better compatibility FROM python:3.12-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ TZ=Europe/Berlin \ PIP_NO_CACHE_DIR=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 # Install only essential runtime dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ tzdata \ && rm -rf /var/lib/apt/lists/* \ && ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \ && echo $TZ > /etc/timezone # Set working directory WORKDIR /app # Install Python dependencies one by one for better memory management on Pi Zero # Using Pydantic v2 which is compatible with newer Python versions RUN pip install --no-cache-dir --no-compile fastapi==0.109.0 RUN pip install --no-cache-dir --no-compile pydantic==2.5.3 RUN pip install --no-cache-dir --no-compile uvicorn==0.25.0 RUN pip install --no-cache-dir --no-compile httpx==0.26.0 RUN pip install --no-cache-dir --no-compile icalendar==5.0.11 RUN pip install --no-cache-dir --no-compile jinja2==3.1.3 RUN pip install --no-cache-dir --no-compile apscheduler==3.10.4 RUN pip install --no-cache-dir --no-compile pytz==2023.3 RUN pip install --no-cache-dir --no-compile python-multipart==0.0.6 # Copy application files COPY main.py . COPY Vektor-Logo.svg ./ # Create static directory and copy logo RUN mkdir -p static && \ cp Vektor-Logo.svg static/logo.svg # Expose port EXPOSE 8000 # Run with limited workers and basic asyncio loop for Pi Zero CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1", "--loop", "asyncio"]