28 lines
839 B
Docker
28 lines
839 B
Docker
FROM python:3.11-slim
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
curl \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
COPY . .
|
|
|
|
EXPOSE 8000
|
|
|
|
# Default: run uvicorn with hot reload for dev.
|
|
# We pass --log-level explicitly from $LOG_LEVEL so uvicorn's own loggers
|
|
# (uvicorn, uvicorn.access) start at the right level from the very first
|
|
# request — without this, they stay at INFO until our lifespan runs.
|
|
# Shell form (not exec form) so ${LOG_LEVEL} is interpolated by the shell.
|
|
CMD sh -c 'exec uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload --log-level "${LOG_LEVEL:-info}"'
|