-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (43 loc) · 1.84 KB
/
Dockerfile
File metadata and controls
55 lines (43 loc) · 1.84 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
50
51
52
53
54
55
# Multi-stage: build frontend, then run backend + serve static
# ---------------------------
# Stage 1: Frontend (Vite + React)
# ---------------------------
FROM node:20-alpine AS frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json* ./
RUN npm ci
COPY frontend/ ./
# Same-origin API in production (backend serves frontend)
ENV VITE_API_URL=
RUN npm run build
# ---------------------------
# Stage 2: Backend (Python + static)
# ---------------------------
FROM python:3.11-slim AS backend
WORKDIR /app
# Git + CA certs required for clone and git log (Summarize with AI)
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps (no venv in container)
COPY backend/requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Install Cursor CLI (for "Summarize with AI" with LLM_PROVIDER=cursor). Official: https://cursor.com/docs/cli/installation
RUN apt-get update && apt-get install -y --no-install-recommends curl && \
mkdir -p /root/.local/bin /root/.cursor/bin && \
export PATH="/root/.local/bin:/root/.cursor/bin:$PATH" && \
(curl -fsSL "https://cursor.com/install" | bash) && \
apt-get remove -y curl 2>/dev/null; apt-get autoremove -y; rm -rf /var/lib/apt/lists/*
ENV PATH="/root/.local/bin:/root/.cursor/bin:${PATH}"
# Backend code
COPY backend/ ./
# Frontend static (from stage 1)
COPY --from=frontend /app/frontend/dist ./static
# Create data dir for volumes (cache, DB)
RUN mkdir -p /data
ENV PYTHONUNBUFFERED=1
EXPOSE 8000
# Run from /app so `app` package and static are found
# --proxy-headers / --forwarded-allow-ips: trust X-Forwarded-* when behind nginx (HTTPS, login redirects)
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]