File size: 1,265 Bytes
73b3c02
 
 
 
369c2da
1681218
 
39a11fc
 
1681218
 
73b3c02
369c2da
e20a283
39a11fc
369c2da
e20a283
 
369c2da
 
73b3c02
e20a283
73b3c02
 
369c2da
73b3c02
369c2da
39a11fc
73b3c02
 
e20a283
73b3c02
 
39a11fc
73b3c02
 
23ad201
 
 
 
e20a283
 
 
 
 
 
 
 
 
 
369c2da
73b3c02
369c2da
 
73b3c02
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
56
# --------------------------
# 1. FRONTEND BUILD STAGE
# --------------------------
FROM node:18 AS frontend-builder

WORKDIR /app

# Copy package manifests from repo root
COPY package.json package-lock.json ./

# Install dependencies
RUN npm install

# Copy full repo (needed for Vite config + frontend/src + public)
COPY . .

# Build the Vite frontend (outputs to /app/frontend/dist)
RUN npm run build


# --------------------------
# 2. PYTHON BACKEND STAGE
# --------------------------
FROM python:3.10

WORKDIR /app

# Backend code
COPY backend/ ./backend/

# Python engine
COPY python_engine/ ./python_engine/

# Tree data
COPY tree_data/ ./tree_data/

# Copy Vite public folder (needed for /static mount)
RUN mkdir -p frontend/public
COPY frontend/public ./frontend/public

# Copy Vite build output
RUN mkdir -p frontend/dist
COPY --from=frontend-builder /app/frontend/dist ./frontend/dist

# Install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# NLTK needs tokenizer data
RUN python -m nltk.downloader punkt
RUN python -m nltk.downloader punkt_tab

ENV PORT=7860
EXPOSE 7860

CMD ["python", "-m", "uvicorn", "backend.app:app", "--host", "0.0.0.0", "--port", "7860"]