FROM python:3.12.8-slim-bookworm WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt && useradd --uid 10001 --create-home app COPY src/ src/ COPY migrations/ migrations/ COPY scripts/ scripts/ COPY tests/ tests/ COPY contracts/ contracts/ COPY lab.json . ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 USER app EXPOSE 8080 CMD ["sh", "-c", "python -m src.db && exec gunicorn --bind 0.0.0.0:8080 --workers 2 --threads 4 --timeout 30 src.app:app"]