Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +15 -13
Dockerfile
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
# These are required by Playwright/Chromium to run on Linux
|
| 9 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 10 |
build-essential \
|
| 11 |
libnss3 \
|
|
@@ -25,25 +29,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 25 |
gnupg \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
-
#
|
| 29 |
COPY ./requirements.txt /code/requirements.txt
|
| 30 |
|
| 31 |
-
#
|
| 32 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 33 |
|
| 34 |
-
#
|
| 35 |
-
# This explicitly downloads the Chromium binaries into the container
|
| 36 |
-
# We only install chromium to save space and speed up build time
|
| 37 |
RUN playwright install chromium --with-deps
|
| 38 |
|
| 39 |
-
# Copy
|
| 40 |
COPY . .
|
| 41 |
|
| 42 |
-
#
|
| 43 |
RUN chmod -R 777 /code
|
| 44 |
|
| 45 |
-
# Expose
|
| 46 |
EXPOSE 7860
|
| 47 |
|
| 48 |
-
#
|
| 49 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# Start from a clean, optimized Python runtime environment
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set systemic environment variables to streamline Python container executions
|
| 5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
| 6 |
+
ENV PYTHONUNBUFFERED=1
|
| 7 |
+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
|
| 8 |
+
|
| 9 |
+
# Establish workspace directory context inside the virtual container filesystem
|
| 10 |
WORKDIR /code
|
| 11 |
|
| 12 |
+
# Install system utilities and native C-libraries essential for Headless Chromium / Playwright execution
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
build-essential \
|
| 15 |
libnss3 \
|
|
|
|
| 29 |
gnupg \
|
| 30 |
&& rm -rf /var/lib/apt/lists/*
|
| 31 |
|
| 32 |
+
# Cache requirements mapping layer independently to optimize subsequent container rebuild timelines
|
| 33 |
COPY ./requirements.txt /code/requirements.txt
|
| 34 |
|
| 35 |
+
# Execute installation of Python dependencies and runtime packages
|
| 36 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 37 |
|
| 38 |
+
# Systematically download and provision isolated Chromium drivers into the target path environment
|
|
|
|
|
|
|
| 39 |
RUN playwright install chromium --with-deps
|
| 40 |
|
| 41 |
+
# Copy the remaining application project directories and codebases directly into the container workspace
|
| 42 |
COPY . .
|
| 43 |
|
| 44 |
+
# Adjust filesystem read/write privileges explicitly to align with Hugging Face runtime space requirements
|
| 45 |
RUN chmod -R 777 /code
|
| 46 |
|
| 47 |
+
# Expose standard networking communication port (Hugging Face standard)
|
| 48 |
EXPOSE 7860
|
| 49 |
|
| 50 |
+
# Bind startup command sequence to execute the root Master Gateway router directly
|
| 51 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|