2026-01-06 12:51:40 +00:00
|
|
|
|
# backend/Dockerfile
|
2025-11-23 09:08:01 +00:00
|
|
|
|
FROM python:3.11-slim
|
|
|
|
|
|
|
2026-01-06 12:51:40 +00:00
|
|
|
|
# 1️⃣ Set a deterministic working directory
|
2025-11-19 21:16:32 +00:00
|
|
|
|
WORKDIR /app
|
2025-11-23 09:08:01 +00:00
|
|
|
|
|
2026-01-06 12:51:40 +00:00
|
|
|
|
# 2️⃣ Copy only the dependency list first – this lets Docker cache the layer
|
2025-11-19 21:16:32 +00:00
|
|
|
|
COPY requirements.txt .
|
2026-01-06 12:51:40 +00:00
|
|
|
|
|
|
|
|
|
|
# 3️⃣ Install Python deps (no cache to keep the image small)
|
2025-11-23 09:08:01 +00:00
|
|
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
2025-11-19 21:16:32 +00:00
|
|
|
|
|
2026-01-06 12:51:40 +00:00
|
|
|
|
# 4️⃣ Now copy the actual source code
|
2025-11-23 09:08:01 +00:00
|
|
|
|
COPY ./app ./app
|
|
|
|
|
|
|
2026-01-06 12:51:40 +00:00
|
|
|
|
# 5️⃣ Expose the port FastAPI will listen on (optional but nice for docs)
|
|
|
|
|
|
EXPOSE 8000
|
|
|
|
|
|
|
|
|
|
|
|
# 6️⃣ Run uvicorn with hot‑reload for local development.
|
|
|
|
|
|
# In production you’d drop the `--reload` flag.
|
|
|
|
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|