Spaces:
Sleeping
Sleeping
Commit
·
d9c4778
1
Parent(s):
53efd5f
fix: dockerfile
Browse files- Dockerfile +32 -23
Dockerfile
CHANGED
|
@@ -1,42 +1,51 @@
|
|
| 1 |
-
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
-
# you will also find guides on how best to write your Dockerfile
|
| 3 |
-
|
| 4 |
FROM python:3.10-slim
|
| 5 |
|
| 6 |
-
# Install system dependencies for Playwright
|
| 7 |
RUN apt-get update && apt-get install -y \
|
| 8 |
libnss3 \
|
|
|
|
| 9 |
libatk1.0-0 \
|
| 10 |
libatk-bridge2.0-0 \
|
|
|
|
|
|
|
| 11 |
libxcomposite1 \
|
| 12 |
libxdamage1 \
|
| 13 |
libxrandr2 \
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
libasound2 \
|
| 18 |
-
|
| 19 |
-
libcups2 \
|
| 20 |
-
libxkbcommon0 \
|
| 21 |
-
libxfixes3 \
|
| 22 |
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
|
| 24 |
-
|
| 25 |
-
USER user
|
| 26 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 27 |
-
|
| 28 |
-
WORKDIR /app
|
| 29 |
|
| 30 |
-
COPY
|
| 31 |
|
| 32 |
-
|
| 33 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 34 |
|
| 35 |
-
# Install Playwright browsers
|
| 36 |
RUN pip install playwright
|
| 37 |
RUN playwright install --with-deps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
RUN playwright install firefox
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
RUN apt-get update && apt-get install -y \
|
| 4 |
libnss3 \
|
| 5 |
+
libnspr4 \
|
| 6 |
libatk1.0-0 \
|
| 7 |
libatk-bridge2.0-0 \
|
| 8 |
+
libcups2 \
|
| 9 |
+
libatspi2.0-0 \
|
| 10 |
libxcomposite1 \
|
| 11 |
libxdamage1 \
|
| 12 |
libxrandr2 \
|
| 13 |
+
libgbm-dev \
|
| 14 |
+
libgtk-3-0 \
|
| 15 |
+
xdg-utils \
|
| 16 |
libasound2 \
|
| 17 |
+
mc \
|
|
|
|
|
|
|
|
|
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
+
WORKDIR /code
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 23 |
|
| 24 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
|
|
|
| 25 |
|
|
|
|
| 26 |
RUN pip install playwright
|
| 27 |
RUN playwright install --with-deps
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
RUN useradd -m -u 1000 user
|
| 31 |
+
USER user
|
| 32 |
+
|
| 33 |
+
ENV HOME=/home/user \
|
| 34 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 35 |
+
PYTHONPATH=$HOME/app \
|
| 36 |
+
PYTHONUNBUFFERED=1 \
|
| 37 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 38 |
+
GRADIO_NUM_PORTS=1 \
|
| 39 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 40 |
+
GRADIO_THEME=huggingface \
|
| 41 |
+
SYSTEM=spaces
|
| 42 |
+
|
| 43 |
+
# Set the working directory to the user's home directory
|
| 44 |
+
WORKDIR $HOME/app
|
| 45 |
+
|
| 46 |
RUN playwright install firefox
|
| 47 |
|
| 48 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 49 |
+
COPY --chown=user . $HOME/app
|
| 50 |
+
|
| 51 |
+
CMD ["python", "app.py"]
|