Yusufarsh commited on
Commit
a601d84
·
verified ·
1 Parent(s): 1d75161

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +47 -47
Dockerfile CHANGED
@@ -1,47 +1,47 @@
1
- # Stage 1: Build React Frontend
2
- FROM node:18-alpine AS frontend-builder
3
- WORKDIR /app/frontend
4
- # Copy only package files first for caching npm install
5
- COPY frontend/package*.json ./
6
- RUN npm ci
7
- # Copy the rest of the frontend source
8
- COPY frontend/ .
9
- RUN npm run build
10
-
11
- # Stage 2: Final Python Backend
12
- FROM python:3.10-slim
13
-
14
- # Set working directory
15
- WORKDIR /app
16
-
17
- # Install system dependencies
18
- RUN apt-get update && apt-get install -y \
19
- git \
20
- curl \
21
- && rm -rf /var/lib/apt/lists/*
22
-
23
- # Copy requirements first (for caching)
24
- COPY requirements.txt .
25
-
26
- # Install Python dependencies
27
- RUN pip install --no-cache-dir --upgrade pip && \
28
- pip install --no-cache-dir -r requirements.txt
29
-
30
- # Copy application code (including backend)
31
- COPY . .
32
-
33
- # Copy the built React app from Stage 1
34
- COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
35
-
36
- # Create necessary directories
37
- RUN mkdir -p data/papers/easy data/papers/medium data/papers/hard logs checkpoints data/tmp
38
-
39
- # Expose port (Hugging Face Spaces uses 7860)
40
- EXPOSE 7860
41
-
42
- # Set environment variables
43
- ENV HOST="0.0.0.0"
44
- ENV PORT=7860
45
-
46
- # Run FastAPI app
47
- CMD ["python", "server/api.py"]
 
1
+ # Stage 1: Build React Frontend
2
+ FROM node:18-alpine AS frontend-builder
3
+ WORKDIR /app/frontend
4
+ # Copy only package files first for caching npm install
5
+ COPY frontend/package*.json ./
6
+ RUN npm ci
7
+ # Copy the rest of the frontend source
8
+ COPY frontend/ .
9
+ RUN npm run build
10
+
11
+ # Stage 2: Final Python Backend
12
+ FROM python:3.12-slim
13
+
14
+ # Set working directory
15
+ WORKDIR /app
16
+
17
+ # Install system dependencies
18
+ RUN apt-get update && apt-get install -y \
19
+ git \
20
+ curl \
21
+ && rm -rf /var/lib/apt/lists/*
22
+
23
+ # Copy requirements first (for caching)
24
+ COPY requirements.txt .
25
+
26
+ # Install Python dependencies
27
+ RUN pip install --no-cache-dir --upgrade pip && \
28
+ pip install --no-cache-dir -r requirements.txt
29
+
30
+ # Copy application code (including backend)
31
+ COPY . .
32
+
33
+ # Copy the built React app from Stage 1
34
+ COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
35
+
36
+ # Create necessary directories
37
+ RUN mkdir -p data/papers/easy data/papers/medium data/papers/hard logs checkpoints data/tmp
38
+
39
+ # Expose port (Hugging Face Spaces uses 7860)
40
+ EXPOSE 7860
41
+
42
+ # Set environment variables
43
+ ENV HOST="0.0.0.0"
44
+ ENV PORT=7860
45
+
46
+ # Run FastAPI app
47
+ CMD ["python", "server/api.py"]