46 lines
1.5 KiB
Docker
46 lines
1.5 KiB
Docker
# Optimized Dockerfile for Raspberry Pi Zero (ARMv6)
|
|
# Minimal memory footprint and no compilation required
|
|
FROM python:3.11-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 older stable versions that are known to work on ARMv6
|
|
RUN pip install --no-cache-dir fastapi==0.95.2
|
|
RUN pip install --no-cache-dir pydantic==1.10.9
|
|
RUN pip install --no-cache-dir uvicorn==0.22.0
|
|
RUN pip install --no-cache-dir httpx==0.24.1
|
|
RUN pip install --no-cache-dir icalendar==5.0.7
|
|
RUN pip install --no-cache-dir jinja2==3.1.2
|
|
RUN pip install --no-cache-dir apscheduler==3.10.1
|
|
RUN pip install --no-cache-dir pytz==2023.3
|
|
RUN pip install --no-cache-dir 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"] |