Spaces:
Sleeping
Sleeping
Commit Β·
d4e5928
1
Parent(s): e92e954
Add root route for HF Space homepage
Browse files- 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
|
| 34 |
-
RUN if [ -f ./
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
&&
|
| 47 |
-
&& npm
|
| 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 &
|
|
|
|
| 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"]
|