24 lines
678 B
Docker
24 lines
678 B
Docker
# Backend image — FastAPI + SQLAlchemy async (asyncpg)
|
|
# The PostgreSQL schema is managed by the postgres service (migration.sql +
|
|
# seed.sql init scripts); this image only runs the API.
|
|
FROM python:3.13-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
WORKDIR /srv/backend
|
|
|
|
# Dependencies first (layer caching)
|
|
# PIP_INDEX_URL overridable (e.g. a China mirror) — default is official PyPI.
|
|
ARG PIP_INDEX_URL=https://pypi.org/simple
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -i ${PIP_INDEX_URL} -r requirements.txt
|
|
|
|
# Application
|
|
COPY app ./app
|
|
COPY tools ./tools
|
|
|
|
EXPOSE 8000
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|