-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 741 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (21 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
FROM python:3.12-slim-bookworm
# Prevents Python from writing .pyc files and makes logs appear immediately
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /usr/src/app
# System deps needed to build psycopg2 (and other compiled wheels)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps first (better caching)
COPY requirements.txt ./
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# Copy app code
COPY . .
# Expose port (optional but nice)
EXPOSE 8000
# Run FastAPI
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]