Nothing12Man commited on
Commit
dc83e3b
·
1 Parent(s): 79c94d2

fix: backend-only Docker configuration for Phase 1 validation

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -30
Dockerfile CHANGED
@@ -1,49 +1,40 @@
1
- # LifeLine AI - Spaces-ready Dockerfile
2
- FROM node:20-slim
 
3
 
4
  LABEL maintainer="LifeLine Team" \
5
- org.opencontainers.image.title="LifeLine AI" \
6
- description="Next.js frontend with optional Python FastAPI backend (Hugging Face Spaces ready)"
7
 
 
8
  ENV PYTHONUNBUFFERED=1 \
9
- DEBIAN_FRONTEND=noninteractive
 
10
 
11
- # Root workspace
12
  WORKDIR /app
13
 
14
- # Install system deps
15
- RUN apt-get update \
16
- && apt-get install -y --no-install-recommends \
17
- python3 python3-pip python3-venv ca-certificates curl build-essential \
18
- && rm -rf /var/lib/apt/lists/*
19
 
20
- # Copy entire repo first
21
  COPY . .
22
 
23
- # Move into frontend folder
24
- WORKDIR /app/lifeline-ai
25
-
26
- # Install ALL dependencies (including devDependencies needed for build)
27
- # NODE_ENV is NOT set to production here — that would skip devDeps and break the build
28
- RUN npm ci --include=dev --no-audit --no-fund
29
-
30
- # Build frontend
31
- RUN npm run build
32
-
33
- # Install backend dependencies if available (using virtual environment)
34
- WORKDIR /app
35
- COPY requirements.txt .
36
  RUN python3 -m venv /opt/venv
37
  ENV PATH="/opt/venv/bin:$PATH"
38
 
 
39
  RUN pip install --no-cache-dir --upgrade pip && \
40
  pip install --no-cache-dir -r requirements.txt
41
 
42
- # Expose HF Space port
43
  EXPOSE 7860
44
 
45
- # Set production mode at runtime only (not at build time)
46
- ENV NODE_ENV=production
47
-
48
- # Run backend as the primary app for OpenEnv validation
49
  CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # LifeLine AI - OpenEnv Phase 1 Validator Dockerfile
2
+ # Optimized for Backend-only compliance to bypass "HTML instead of JSON" errors
3
+ FROM python:3.11-slim
4
 
5
  LABEL maintainer="LifeLine Team" \
6
+ org.opencontainers.image.title="LifeLine AI - Phase 1 Backend" \
7
+ description="Backend-only deployment for OpenEnv Phase 1 validation"
8
 
9
+ # Environment variables
10
  ENV PYTHONUNBUFFERED=1 \
11
+ DEBIAN_FRONTEND=noninteractive \
12
+ NODE_ENV=production
13
 
14
+ # Workspace setup
15
  WORKDIR /app
16
 
17
+ # Install system build dependencies
18
+ RUN apt-get update && \
19
+ apt-get install -y --no-install-recommends \
20
+ build-essential curl ca-certificates && \
21
+ rm -rf /var/lib/apt/lists/*
22
 
23
+ # Copy the entire codebase
24
  COPY . .
25
 
26
+ # Virtual Environment implementation (compliant with modern Linux distros)
 
 
 
 
 
 
 
 
 
 
 
 
27
  RUN python3 -m venv /opt/venv
28
  ENV PATH="/opt/venv/bin:$PATH"
29
 
30
+ # Install Python requirements
31
  RUN pip install --no-cache-dir --upgrade pip && \
32
  pip install --no-cache-dir -r requirements.txt
33
 
34
+ # Expose Hugging Face Space port
35
  EXPOSE 7860
36
 
37
+ # --- Phase 1 Specific ---
38
+ # We ONLY start the FastAPI backend on port 7860.
39
+ # No Next.js started, no shell-redirection, no background processes.
 
40
  CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "7860"]