Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +16 -35
Dockerfile
CHANGED
|
@@ -1,53 +1,34 @@
|
|
| 1 |
-
#
|
| 2 |
-
# 1. BASE RUNTIME SETUP
|
| 3 |
-
# =====================================================================
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
-
# Prevent Python from writing .pyc files and buffer streams for real-time logs
|
| 7 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 8 |
ENV PYTHONUNBUFFERED=1
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
ENV PYTHONPATH=/app
|
| 13 |
|
| 14 |
-
# Establish the core execution workspace
|
| 15 |
-
WORKDIR /app
|
| 16 |
-
|
| 17 |
-
# =====================================================================
|
| 18 |
-
# 2. SYSTEM DEPENDENCIES & LINUX LIBRARIES
|
| 19 |
-
# =====================================================================
|
| 20 |
-
# Install essential compilation tools and library components
|
| 21 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 22 |
build-essential \
|
| 23 |
curl \
|
| 24 |
git \
|
| 25 |
&& rm -rf /var/lib/apt/lists/*
|
| 26 |
|
| 27 |
-
#
|
| 28 |
-
|
| 29 |
-
# =====================================================================
|
| 30 |
-
# Copy requirements first to leverage Docker's layer caching architecture
|
| 31 |
-
COPY Server/requirements.txt /app/Server/requirements.txt
|
| 32 |
-
|
| 33 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 34 |
-
pip install --no-cache-dir -r /
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
# This ensures Engine 6's interactive sandbox doesn't crash on system missing (.so) links
|
| 38 |
RUN playwright install --with-deps chromium
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
EXPOSE
|
| 48 |
|
| 49 |
-
|
| 50 |
-
# 5. SECURE RUNTIME EXECUTION
|
| 51 |
-
# =====================================================================
|
| 52 |
-
# Execute from the root context, completely safe under the injected PYTHONPATH
|
| 53 |
-
CMD ["uvicorn", "Server.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
|
|
|
| 1 |
+
# Location: /Dockerfile (Absolute Root Directory)
|
|
|
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
|
|
|
| 4 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 5 |
ENV PYTHONUNBUFFERED=1
|
| 6 |
+
ENV PYTHONPATH=/home/user/app
|
| 7 |
|
| 8 |
+
# Hugging Face default home directory mapping
|
| 9 |
+
WORKDIR /home/user/app
|
|
|
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
build-essential \
|
| 13 |
curl \
|
| 14 |
git \
|
| 15 |
&& rm -rf /var/lib/apt/lists/*
|
| 16 |
|
| 17 |
+
# Copy requirements using the root layout structure
|
| 18 |
+
COPY Server/requirements.txt ./Server/requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 20 |
+
pip install --no-cache-dir -r ./Server/requirements.txt
|
| 21 |
|
| 22 |
+
# Install Playwright dependencies for Engine 6
|
|
|
|
| 23 |
RUN playwright install --with-deps chromium
|
| 24 |
|
| 25 |
+
# Copy all code vectors into the execution hub
|
| 26 |
+
COPY . .
|
| 27 |
+
|
| 28 |
+
# Set permissions for Hugging Face non-root user (UID 1000)
|
| 29 |
+
RUN chmod -R 777 /home/user/app
|
| 30 |
|
| 31 |
+
# 🔥 Hugging Face requires traffic routing on port 7860
|
| 32 |
+
EXPOSE 7860
|
| 33 |
|
| 34 |
+
CMD ["uvicorn", "Server.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|