-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (20 loc) · 968 Bytes
/
Copy pathDockerfile
File metadata and controls
28 lines (20 loc) · 968 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.13-slim AS base
WORKDIR /app
# System deps for psycopg2-binary and scipy
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq5 \
&& rm -rf /var/lib/apt/lists/*
# ── Dependencies layer (cached unless requirements.txt changes) ───────────────
FROM base AS deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# ── Final image ───────────────────────────────────────────────────────────────
FROM deps AS app
COPY . .
# Non-root user for security
RUN useradd -m -u 1000 appuser && chown -R appuser /app
USER appuser
EXPOSE 8000
# DATABASE_URL must be set via environment variable or docker-compose
ENV DATABASE_URL=postgresql://postgres:postgres@db:5432/data_lens
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]