Spaces:
3SCError404
/
Paused

dushyantsingh0 commited on
Commit
f332708
·
1 Parent(s): 757203c

fix: include frontend in docker context

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -11
Dockerfile CHANGED
@@ -1,17 +1,24 @@
1
  # --- STAGE 1: FRONTEND BUILD (Node.js) ---
2
  FROM node:20-slim AS frontend-builder
3
- WORKDIR /app/frontend
 
 
 
4
 
5
- # Copy frontend workspace files
6
- COPY frontend/package*.json ./
7
- COPY frontend/packages ./packages
8
- COPY frontend/apps ./apps
9
- COPY frontend/tsconfig.json ./
 
 
 
 
10
 
11
- # Install and Build all workspaces
12
- # Note: We build WITHOUT an explicit VITE_API_URL so the client defaults to relative paths
13
  RUN npm install
14
- RUN npm run build --workspaces
 
15
 
16
  # --- STAGE 2: BACKEND BASE (Python) ---
17
  FROM python:3.11-slim AS base
@@ -34,7 +41,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
34
  COPY requirements.txt .
35
  RUN pip install --no-cache-dir -r requirements.txt
36
 
37
- # --- STAGE 3: HEAVY-AI (Optional logic) ---
38
  FROM base AS heavy
39
  COPY requirements-ai.txt .
40
  RUN pip install --no-cache-dir -r requirements-ai.txt
@@ -46,7 +53,7 @@ WORKDIR /app
46
  # Copy backend application code
47
  COPY . .
48
 
49
- # Copy BUILT frontend assets from Stage 1 into the backend directories
50
  COPY --from=frontend-builder /app/frontend/apps/customer/dist ./frontend/apps/customer/dist
51
  COPY --from=frontend-builder /app/frontend/apps/internal/dist ./frontend/apps/internal/dist
52
 
 
1
  # --- STAGE 1: FRONTEND BUILD (Node.js) ---
2
  FROM node:20-slim AS frontend-builder
3
+ WORKDIR /app
4
+
5
+ # Increase memory for the JS builder to prevent "exit code: 2" crashes
6
+ ENV NODE_OPTIONS="--max-old-space-size=4096"
7
 
8
+ # Copy monorepo root config
9
+ COPY frontend/package*.json ./frontend/
10
+ COPY frontend/tsconfig.json ./frontend/
11
+
12
+ # Copy all packages and apps
13
+ COPY frontend/packages ./frontend/packages
14
+ COPY frontend/apps ./frontend/apps
15
+
16
+ WORKDIR /app/frontend
17
 
18
+ # Install and build sequentially (More reliable than --workspaces)
 
19
  RUN npm install
20
+ RUN npm run build -w apps/customer
21
+ RUN npm run build -w apps/internal
22
 
23
  # --- STAGE 2: BACKEND BASE (Python) ---
24
  FROM python:3.11-slim AS base
 
41
  COPY requirements.txt .
42
  RUN pip install --no-cache-dir -r requirements.txt
43
 
44
+ # --- STAGE 3: HEAVY-AI ---
45
  FROM base AS heavy
46
  COPY requirements-ai.txt .
47
  RUN pip install --no-cache-dir -r requirements-ai.txt
 
53
  # Copy backend application code
54
  COPY . .
55
 
56
+ # Copy BUILT frontend assets from Stage 1
57
  COPY --from=frontend-builder /app/frontend/apps/customer/dist ./frontend/apps/customer/dist
58
  COPY --from=frontend-builder /app/frontend/apps/internal/dist ./frontend/apps/internal/dist
59