Files
pragativeer-v2/backend/Dockerfile.dev

30 lines
1.6 KiB
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ═══════════════════════════════════════════════════════════════════════════
# PragatiVeer Backend – Python 3.11 slim
# Optimised for fast re-builds:
# • requirements.txt copied FIRST → pip cache layer is only invalidated
# when dependencies change, not on every source-code edit.
# • BuildKit pip cache mount keeps wheel cache on host between builds.
# ═══════════════════════════════════════════════════════════════════════════
FROM python:3.11-slim
# Install system deps in a single RUN layer, clean apt cache immediately
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# ── Dependencies first (most stable layer) ──────────────────────────────────
COPY requirements.txt .
# Use BuildKit pip cache so wheels are reused across builds
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --no-cache-dir -r requirements.txt
# ── Source code (changes frequently; comes last) ─────────────────────────────
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]