Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +43 -45
Dockerfile
CHANGED
|
@@ -1,55 +1,53 @@
|
|
| 1 |
-
#
|
|
|
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
ENV PYTHONUNBUFFERED=1
|
| 7 |
-
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
|
|
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
build-essential \
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
libatk1.0-0 \
|
| 18 |
-
libatk-bridge2.0-0 \
|
| 19 |
-
libcups2 \
|
| 20 |
-
libdrm2 \
|
| 21 |
-
libxkbcommon0 \
|
| 22 |
-
libxcomposite1 \
|
| 23 |
-
libxdamage1 \
|
| 24 |
-
libxfixes3 \
|
| 25 |
-
libxrandr2 \
|
| 26 |
-
libgbm1 \
|
| 27 |
-
libasound2 \
|
| 28 |
-
wget \
|
| 29 |
-
gnupg \
|
| 30 |
&& rm -rf /var/lib/apt/lists/*
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
#
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
#
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
#
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# 🔥 THE PERMANENT FIX: Force the container to include the root workspace
|
| 11 |
+
# in Python's search path so 'Server' is globally discoverable as a module.
|
| 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 |
+
# 3. DEPENDENCY INSTALLATION (CACHED LAYER)
|
| 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 /app/Server/requirements.txt
|
| 35 |
+
|
| 36 |
+
# 🛠️ PLAYWRIGHT LINUX SUBSYSTEM MATCH: Install Chromium and its Linux dependencies
|
| 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 |
+
# 4. APPLICATION SOURCE DEPLOYMENT
|
| 42 |
+
# =====================================================================
|
| 43 |
+
# Copy the entire workspace tree into the container (preserves Version_2-Copy, etc.)
|
| 44 |
+
COPY . /app
|
| 45 |
+
|
| 46 |
+
# Expose the master gateway network port
|
| 47 |
+
EXPOSE 8000
|
| 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"]
|