12345678910111213141516171819202122232425262728293031 |
- # syntax=docker/dockerfile:1
- FROM python:3.11-slim AS base
- ENV PYTHONDONTWRITEBYTECODE=1 \
- PYTHONUNBUFFERED=1 \
- PIP_DISABLE_PIP_VERSION_CHECK=1 \
- PIP_NO_CACHE_DIR=1
- WORKDIR /app
- # System deps
- RUN apt-get update -y && apt-get install -y --no-install-recommends \
- build-essential curl && \
- rm -rf /var/lib/apt/lists/*
- # Install Python deps first (better layer caching)
- COPY requirements.txt .
- RUN pip install -r requirements.txt
- # Copy source
- COPY app ./app
- COPY README.md .
- # Optionally copy .env at build time (usually mounted at runtime)
- COPY .env .
- EXPOSE 8000
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|