abdurafay19 commited on
Commit
73f2e69
·
verified ·
1 Parent(s): 0f90f9e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -17
Dockerfile CHANGED
@@ -1,34 +1,37 @@
1
- # Use Python + Node
2
  FROM python:3.10-slim
3
 
4
  # System deps
5
- RUN apt-get update && apt-get install -y curl build-essential gnupg && rm -rf /var/lib/apt/lists/*
 
 
6
 
7
- # Install Node.js (v20 LTS) + pnpm
8
- RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
9
- && apt-get install -y nodejs \
10
- && npm install -g pnpm
11
 
12
- # Set environment
13
  ENV PATH="/root/.local/share/pnpm:${PATH}"
14
- WORKDIR /app
15
 
16
- # Copy backend
17
- COPY main.py model.py requirements.txt /app/
18
 
19
- # Install Python dependencies
 
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # Copy frontend
23
- COPY UI /app/UI
24
  WORKDIR /app/UI
 
25
 
26
- # Install frontend dependencies
27
- RUN pnpm install
 
 
 
 
 
28
  RUN pnpm build
29
 
30
- # Expose ports
31
  EXPOSE 8000 7860
32
 
33
- # Run both backend & frontend
34
  CMD sh -c "cd /app && uvicorn main:app --host 0.0.0.0 --port 8000 & cd /app/UI && pnpm start -p 7860"
 
 
1
  FROM python:3.10-slim
2
 
3
  # System deps
4
+ RUN apt-get update && \
5
+ apt-get install -y curl build-essential gnupg && \
6
+ rm -rf /var/lib/apt/lists/*
7
 
8
+ # Node + pnpm
9
+ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
10
+ apt-get install -y nodejs && \
11
+ npm install -g pnpm
12
 
 
13
  ENV PATH="/root/.local/share/pnpm:${PATH}"
 
14
 
15
+ WORKDIR /app
 
16
 
17
+ # Python deps
18
+ COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Frontend deps
22
+ COPY UI/package.json UI/pnpm-lock.yaml ./UI/
23
  WORKDIR /app/UI
24
+ RUN pnpm install --frozen-lockfile
25
 
26
+ # Source code (changes most often)
27
+ WORKDIR /app
28
+ COPY main.py model.py ./
29
+ COPY UI ./UI
30
+
31
+ # Build frontend
32
+ WORKDIR /app/UI
33
  RUN pnpm build
34
 
 
35
  EXPOSE 8000 7860
36
 
 
37
  CMD sh -c "cd /app && uvicorn main:app --host 0.0.0.0 --port 8000 & cd /app/UI && pnpm start -p 7860"