Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +16 -9
Dockerfile
CHANGED
|
@@ -6,6 +6,15 @@ RUN apt-get update && apt-get install -y \
|
|
| 6 |
gnupg \
|
| 7 |
fontconfig \
|
| 8 |
build-essential \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
# Create non-root user
|
|
@@ -22,7 +31,6 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key
|
|
| 22 |
fonts-thai-tlwg \
|
| 23 |
fonts-kacst \
|
| 24 |
fonts-freefont-ttf \
|
| 25 |
-
libxss1 \
|
| 26 |
&& rm -rf /var/lib/apt/lists/*
|
| 27 |
|
| 28 |
# Set up working directory and permissions
|
|
@@ -45,15 +53,14 @@ ENV XDG_CACHE_HOME=/home/crawler/.cache
|
|
| 45 |
ENV PIP_CACHE_DIR=/home/crawler/.cache/pip
|
| 46 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 47 |
|
| 48 |
-
#
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
|
| 53 |
-
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 54 |
-
|
| 55 |
-
# Install Playwright browsers
|
| 56 |
-
RUN python -m playwright install chromium --with-deps
|
| 57 |
|
| 58 |
# Copy application code
|
| 59 |
COPY --chown=crawler:crawler . .
|
|
|
|
| 6 |
gnupg \
|
| 7 |
fontconfig \
|
| 8 |
build-essential \
|
| 9 |
+
xvfb \
|
| 10 |
+
libgbm1 \
|
| 11 |
+
libnss3 \
|
| 12 |
+
libxss1 \
|
| 13 |
+
libasound2 \
|
| 14 |
+
libxrandr2 \
|
| 15 |
+
libatk1.0-0 \
|
| 16 |
+
libgtk-3-0 \
|
| 17 |
+
libxshmfence1 \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
# Create non-root user
|
|
|
|
| 31 |
fonts-thai-tlwg \
|
| 32 |
fonts-kacst \
|
| 33 |
fonts-freefont-ttf \
|
|
|
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
# Set up working directory and permissions
|
|
|
|
| 53 |
ENV PIP_CACHE_DIR=/home/crawler/.cache/pip
|
| 54 |
ENV PYTHONDONTWRITEBYTECODE=1
|
| 55 |
|
| 56 |
+
# Install Python dependencies and Playwright as root first
|
| 57 |
+
COPY requirements.txt .
|
| 58 |
+
RUN pip install --no-cache-dir -r requirements.txt && \
|
| 59 |
+
playwright install --with-deps chromium && \
|
| 60 |
+
rm -rf /root/.cache/*
|
| 61 |
|
| 62 |
+
# Switch to non-root user
|
| 63 |
+
USER crawler
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
# Copy application code
|
| 66 |
COPY --chown=crawler:crawler . .
|