FROM python:3.11.9-slim-bookworm ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 WORKDIR /app RUN groupadd --system app && useradd --system --gid app --home-dir /app app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app ./app COPY migrations ./migrations COPY scripts ./scripts COPY tests ./tests COPY contracts ./contracts COPY lab.json . COPY alembic.ini . RUN chown -R app:app /app USER app EXPOSE 8443 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8443", "--ssl-keyfile", "/run/tls/api.key", "--ssl-certfile", "/run/tls/api.crt", "--ssl-ca-certs", "/run/tls/lb-ca.crt", "--ssl-cert-reqs", "2", "--timeout-keep-alive", "5", "--timeout-graceful-shutdown", "20"]