-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (37 loc) · 1.47 KB
/
Dockerfile
File metadata and controls
49 lines (37 loc) · 1.47 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# syntax=docker/dockerfile:1.6
# pinning to patch tag, instead of
# FROM python:3.11-slim AS base
FROM python:3.11.8-slim-bookworm AS base
WORKDIR /app
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app/src
# Basic build deps (keep minimal; add build-essential only if you hit compile errors)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Poetry
RUN pip install --no-cache-dir poetry==1.8.3
# ------------------------------------------------------------
# 1) cap_deps: installs all python deps (main + rag)
# ------------------------------------------------------------
FROM base AS cap_deps
# Copy manifests first for caching
COPY pyproject.toml poetry.lock ./
# IMPORTANT:
# - DO NOT use --only if you want rag too.
# - Default is "main", and --with rag adds rag.
RUN --mount=type=cache,target=/root/.cache/pypoetry \
--mount=type=cache,target=/root/.cache/pip \
poetry config virtualenvs.create false \
&& poetry install --with rag --without dev --no-root --no-interaction --no-ansi
# ------------------------------------------------------------
# 2) cap_server: reuses deps layer, only copies code
# ------------------------------------------------------------
FROM cap_deps AS cap_server
COPY src/ src/
COPY datasets/ datasets/
EXPOSE 8000
# Where the command actually comes from (if compose doesn't override it)
CMD ["uvicorn", "src.cap.main:app", "--host", "0.0.0.0", "--port", "8000"]