Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +32 -6
Dockerfile
CHANGED
|
@@ -1,8 +1,34 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
EXPOSE 7860
|
| 8 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Python image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies required for Playwright
|
| 8 |
+
RUN apt-get update && apt-get install -y \
|
| 9 |
+
wget \
|
| 10 |
+
gnupg \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
# Copy requirements and install Python packages
|
| 14 |
+
COPY requirements.txt .
|
| 15 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 16 |
+
|
| 17 |
+
# Install Playwright Browsers (Chromium) and System Dependencies
|
| 18 |
+
RUN playwright install chromium
|
| 19 |
+
RUN playwright install-deps chromium
|
| 20 |
+
|
| 21 |
+
# Copy the rest of the application
|
| 22 |
+
COPY . .
|
| 23 |
+
|
| 24 |
+
# Create a non-root user (Hugging Face Security Requirement)
|
| 25 |
+
RUN useradd -m -u 1000 user
|
| 26 |
+
USER user
|
| 27 |
+
ENV HOME=/home/user \
|
| 28 |
+
PATH=/home/user/.local/bin:$PATH
|
| 29 |
+
|
| 30 |
+
# Expose the port
|
| 31 |
EXPOSE 7860
|
| 32 |
+
|
| 33 |
+
# Run the application
|
| 34 |
+
CMD ["python", "app.py"]
|