Spaces:
Sleeping
Sleeping
Commit Β·
d0dcff2
1
Parent(s): d4e5928
Fix missing backend requirements path
Browse files- Dockerfile +29 -58
Dockerfile
CHANGED
|
@@ -1,70 +1,41 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
version="1.0.0" \
|
| 8 |
-
description="Medical Triage and Hospital Routing OpenEnv Environment" \
|
| 9 |
-
org.opencontainers.image.title="MediRoute OpenEnv" \
|
| 10 |
-
org.opencontainers.image.licenses="MIT"
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
ca-certificates \
|
| 16 |
-
gnupg \
|
| 17 |
-
build-essential \
|
| 18 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
-
|
| 20 |
-
# ββ Python runtime defaults βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 21 |
-
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 22 |
-
PYTHONUNBUFFERED=1
|
| 23 |
|
| 24 |
-
# ββ Working directory βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 25 |
WORKDIR /app
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
COPY
|
| 34 |
-
RUN if [ -f
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
COPY
|
| 40 |
-
RUN
|
| 41 |
-
|
| 42 |
-
fi
|
| 43 |
|
| 44 |
-
#
|
| 45 |
-
# Copying the full project avoids file-not-found build breaks and is HF-Spaces-friendly.
|
| 46 |
COPY . .
|
|
|
|
| 47 |
|
| 48 |
-
#
|
| 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
|
| 57 |
-
USER appuser
|
| 58 |
-
|
| 59 |
-
# ββ Environment variable defaults (override at runtime) βββββββββββββββββββββββ
|
| 60 |
-
ENV OPENAI_API_KEY="EMPTY" \
|
| 61 |
-
API_BASE_URL="https://api.openai.com/v1" \
|
| 62 |
-
MODEL_NAME="gpt-4o-mini" \
|
| 63 |
-
HF_TOKEN=""
|
| 64 |
-
|
| 65 |
-
# ββ Expose the port expected by Hugging Face Spaces (frontend)
|
| 66 |
EXPOSE 7860
|
| 67 |
|
| 68 |
-
#
|
| 69 |
-
|
| 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"]
|
|
|
|
| 1 |
+
# LifeLine AI - Spaces-ready Dockerfile (clean, repo-root centric)
|
| 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 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"]
|
|
|