Nothing12Man commited on
Commit
d4e5928
Β·
1 Parent(s): e92e954

Add root route for HF Space homepage

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -30,10 +30,16 @@ RUN pip install --no-cache-dir --upgrade pip \
30
  && pip install --no-cache-dir -r requirements.txt
31
 
32
  # If a backend requirements file exists (lifeline-ai/backend/requirements.txt), install it too
33
- COPY lifeline-ai/backend/requirements.txt ./lifeline-backend-requirements.txt
34
- RUN if [ -f ./lifeline-backend-requirements.txt ]; then \
35
- pip install --no-cache-dir -r ./lifeline-backend-requirements.txt; \
36
- fi
 
 
 
 
 
 
37
 
38
  # ── Copy application source safely ────────────────────────────────────────────
39
  # Copying the full project avoids file-not-found build breaks and is HF-Spaces-friendly.
@@ -43,9 +49,8 @@ COPY . .
43
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
44
  && apt-get update && apt-get install -y --no-install-recommends nodejs \
45
  && rm -rf /var/lib/apt/lists/* \
46
- && cd lifeline-ai \
47
- && npm ci --no-audit --no-fund || npm install \
48
- && npm run build
49
 
50
  # ── Non-root user for security ────────────────────────────────────────────────
51
  RUN adduser --disabled-password --gecos "" appuser
@@ -62,4 +67,4 @@ EXPOSE 7860
62
 
63
  # Default command: start backend on 8000 (background) and run Next.js frontend on 7860
64
  # The frontend proxies /api to the backend via next.config.js rewrites.
65
- CMD ["sh", "-c", "uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 & cd lifeline-ai && exec npm run start -- -p 7860"]
 
30
  && pip install --no-cache-dir -r requirements.txt
31
 
32
  # If a backend requirements file exists (lifeline-ai/backend/requirements.txt), install it too
33
+ COPY backend/requirements.txt ./backend-requirements.txt
34
+ RUN if [ -f ./backend-requirements.txt ]; then \
35
+ pip install --no-cache-dir -r ./backend-requirements.txt; \
36
+ fi
37
+
38
+ # Backwards-compat: install lifeline-ai/backend/requirements.txt if present
39
+ COPY lifeline-ai/backend/requirements.txt ./lifeline-ai-backend-requirements.txt
40
+ RUN if [ -f ./lifeline-ai-backend-requirements.txt ]; then \
41
+ pip install --no-cache-dir -r ./lifeline-ai-backend-requirements.txt; \
42
+ fi
43
 
44
  # ── Copy application source safely ────────────────────────────────────────────
45
  # Copying the full project avoids file-not-found build breaks and is HF-Spaces-friendly.
 
49
  RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
50
  && apt-get update && apt-get install -y --no-install-recommends nodejs \
51
  && rm -rf /var/lib/apt/lists/* \
52
+ && npm ci --prefix lifeline-ai --no-audit --no-fund || npm install --prefix lifeline-ai \
53
+ && npm run build --prefix lifeline-ai
 
54
 
55
  # ── Non-root user for security ────────────────────────────────────────────────
56
  RUN adduser --disabled-password --gecos "" appuser
 
67
 
68
  # Default command: start backend on 8000 (background) and run Next.js frontend on 7860
69
  # The frontend proxies /api to the backend via next.config.js rewrites.
70
+ CMD ["sh", "-c", "uvicorn backend.app.main:app --host 127.0.0.1 --port 8000 & exec npm run start --prefix lifeline-ai -- -p 7860"]