2.9 KiB
2.9 KiB
🔧 ARM/Raspberry Pi Build Solution
The Problem
Your build is failing because pydantic-core (required by Pydantic v2) needs Rust and a C compiler to compile from source. This is a common issue on ARM devices like Raspberry Pi.
The Solution: Use Pydantic v1
The simplest solution is to use Pydantic v1 which is pure Python and doesn't require any compilation.
Quick Fix
Option 1: Use the Minimal Dockerfile (Recommended)
# This Dockerfile uses Pydantic v1 - no compilation needed!
podman build -f Dockerfile.minimal -t turmli-calendar .
podman run -d -p 8000:8000 turmli-calendar
Option 2: Create a simple requirements.txt
# Save this as requirements-simple.txt
fastapi==0.95.2
pydantic==1.10.9
uvicorn==0.22.0
httpx==0.24.1
icalendar==5.0.7
jinja2==3.1.2
apscheduler==3.10.1
pytz==2023.3
python-multipart==0.0.6
Then build with:
podman build -t turmli-calendar .
Why This Works
- Pydantic v1 (1.10.x) is pure Python - no Rust required
- FastAPI 0.95.x works perfectly with Pydantic v1
- Basic uvicorn (without [standard]) avoids uvloop/httptools compilation
- All other dependencies are pure Python
Performance Impact: NONE for Your Use Case
Your calendar app:
- Fetches a calendar every 30 minutes
- Serves maybe 100 requests per hour
- Doesn't use WebSockets
- Doesn't need microsecond response times
The "fast" packages (uvloop, httptools) are for apps handling thousands of requests per second. You don't need them.
Complete Working Dockerfile
FROM python:3.13-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
TZ=Europe/Berlin
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
WORKDIR /app
# Use Pydantic v1 - no compilation needed!
RUN pip install --no-cache-dir \
fastapi==0.95.2 \
pydantic==1.10.9 \
uvicorn==0.22.0 \
httpx==0.24.1 \
icalendar==5.0.7 \
jinja2==3.1.2 \
apscheduler==3.10.1 \
pytz==2023.3 \
python-multipart==0.0.6
COPY main.py .
COPY Vektor-Logo.svg ./
RUN mkdir -p static && \
cp Vektor-Logo.svg static/logo.svg
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Build Times Comparison
| Configuration | Build Time | Works on ARM? |
|---|---|---|
| uvicorn[standard] + Pydantic v2 | 15+ minutes | ❌ Fails without gcc/rust |
| Basic uvicorn + Pydantic v1 | 30 seconds | ✅ Yes! |
Summary
Don't overcomplicate it! Your app doesn't need:
- ❌ Rust compilation for pydantic-core
- ❌ C compilation for httptools/uvloop
- ❌ WebSocket support
- ❌ File watching for development
- ❌ Microsecond optimizations
Just use the minimal configuration with Pydantic v1. It works perfectly for your calendar application and builds in seconds on any platform.