FROM python:3.14-slim ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY app ./app # Non-root user; the SQLite database lives on the /data volume RUN useradd --create-home gateway && mkdir /data && chown gateway:gateway /data USER gateway ENV GATEWAY_DATABASE_URL=sqlite:////data/gateway.db EXPOSE 8000 HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ CMD python -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)" # Single worker on purpose: the rate limiter and sync cache are in-memory. CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]