Nothing12Man commited on
Commit
174e1d1
·
1 Parent(s): 735ebcc

Fix Dockerfile working directory for frontend

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -12
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # LifeLine AI - Spaces-ready Dockerfile (clean, repo-root centric)
2
  FROM node:20-slim
3
 
4
  LABEL maintainer="LifeLine Team" \
@@ -9,33 +9,39 @@ ENV NODE_ENV=production \
9
  PYTHONUNBUFFERED=1 \
10
  DEBIAN_FRONTEND=noninteractive
11
 
 
12
  WORKDIR /app
13
 
14
- # Install minimal system deps (python + build tools)
15
  RUN apt-get update \
16
  && apt-get install -y --no-install-recommends \
17
  python3 python3-pip ca-certificates curl build-essential \
18
  && rm -rf /var/lib/apt/lists/*
19
 
20
- # Copy Node package manifests and install Node deps from repo root
21
- COPY package*.json ./
 
 
 
 
 
22
  RUN if [ -f package-lock.json ]; then \
23
  npm ci --no-audit --no-fund; \
24
  else \
25
  npm install --no-audit --no-fund; \
26
  fi
27
 
28
- # Install Python dependencies from repo-root requirements.txt only
 
 
 
 
29
  COPY requirements.txt .
30
  RUN pip install --no-cache-dir --upgrade pip && \
31
  pip install --no-cache-dir -r requirements.txt
32
 
33
- # Copy the rest of the repository and build the Next.js frontend
34
- COPY . .
35
- RUN npm run build
36
-
37
- # Expose the UI port for Hugging Face Spaces
38
  EXPOSE 7860
39
 
40
- # Start backend (if present) on localhost:8000 in background, then run Next.js frontend on 7860
41
- CMD ["sh", "-c", "uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 2>/dev/null & exec npm run start -- -p 7860"]
 
1
+ # LifeLine AI - Spaces-ready Dockerfile
2
  FROM node:20-slim
3
 
4
  LABEL maintainer="LifeLine Team" \
 
9
  PYTHONUNBUFFERED=1 \
10
  DEBIAN_FRONTEND=noninteractive
11
 
12
+ # Root workspace
13
  WORKDIR /app
14
 
15
+ # Install system deps
16
  RUN apt-get update \
17
  && apt-get install -y --no-install-recommends \
18
  python3 python3-pip ca-certificates curl build-essential \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
+ # Copy entire repo first
22
+ COPY . .
23
+
24
+ # Move into frontend folder
25
+ WORKDIR /app/lifeline-ai
26
+
27
+ # Install frontend dependencies
28
  RUN if [ -f package-lock.json ]; then \
29
  npm ci --no-audit --no-fund; \
30
  else \
31
  npm install --no-audit --no-fund; \
32
  fi
33
 
34
+ # Build frontend
35
+ RUN npm run build
36
+
37
+ # Install backend dependencies if available
38
+ WORKDIR /app
39
  COPY requirements.txt .
40
  RUN pip install --no-cache-dir --upgrade pip && \
41
  pip install --no-cache-dir -r requirements.txt
42
 
43
+ # Expose HF Space port
 
 
 
 
44
  EXPOSE 7860
45
 
46
+ # Run backend + frontend
47
+ CMD ["sh", "-c", "uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 2>/dev/null & cd /app/lifeline-ai && exec npm run start -- -p 7860"]