Jotzy/backend/Dockerfile

22 lines
681 B
Docker
Raw Normal View History

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 hotreload for local development.
# In production youd drop the `--reload` flag.
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]