gwoe-antragspruefer/Dockerfile

35 lines
853 B
Docker
Raw Normal View History

FROM python:3.12-slim
# Install system dependencies for WeasyPrint
RUN apt-get update && apt-get install -y --no-install-recommends \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libgdk-pixbuf-2.0-0 \
libffi-dev \
shared-mime-info \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code only (data/reports are mounted as volumes)
COPY app/ ./app/
# Create non-root user and directories (#119 Security)
RUN adduser --disabled-password --gecos '' --uid 1000 appuser \
&& mkdir -p /app/data /app/reports \
&& chown -R appuser:appuser /app
USER appuser
# Environment
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]