etukurudinesh commited on
Commit
29cde94
·
1 Parent(s): 20e40f1
Files changed (2) hide show
  1. Dockerfile +26 -31
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -1,6 +1,5 @@
1
  FROM python:3.10-slim
2
 
3
- # Install Playwright system dependencies as root
4
  RUN apt-get update && apt-get install -y \
5
  libnss3 \
6
  libnspr4 \
@@ -11,46 +10,42 @@ RUN apt-get update && apt-get install -y \
11
  libxcomposite1 \
12
  libxdamage1 \
13
  libxrandr2 \
14
- libgbm1 \
15
  libgtk-3-0 \
16
- libasound2 \
17
  xdg-utils \
18
- wget \
19
- ca-certificates \
20
- fonts-liberation \
21
- libappindicator3-1 \
22
- libpangocairo-1.0-0 \
23
- libx11-xcb1 \
24
- libxss1 \
25
- libxtst6 \
26
  && rm -rf /var/lib/apt/lists/*
27
 
28
- # Install Python dependencies and Playwright as root
29
- RUN pip install --no-cache-dir --upgrade pip \
30
- && pip install --no-cache-dir playwright \
31
- && playwright install --with-deps chromium
 
 
 
 
 
32
 
33
- # Create non-root user
34
  RUN useradd -m -u 1000 user
35
  USER user
 
36
  ENV HOME=/home/user \
37
- PATH=/home/user/.local/bin:$PATH \
38
- PLAYWRIGHT_BROWSERS_PATH=/home/user/.cache/ms-playwright \
39
- GRADIO_ALLOW_FLAGGING=never \
40
- GRADIO_NUM_PORTS=1 \
41
- GRADIO_SERVER_NAME=0.0.0.0 \
42
- GRADIO_THEME=huggingface \
43
- SYSTEM=spaces
 
44
 
45
- WORKDIR /app
 
46
 
47
- # Copy and install app dependencies
48
- COPY --chown=user:user requirements.txt .
49
- RUN pip install --no-cache-dir --upgrade -r requirements.txt \
50
- && pip install --no-cache-dir "gradio[mcp]"
51
 
52
- # Copy app files
53
- COPY --chown=user:user . .
54
 
55
- EXPOSE 7860
56
  CMD ["python", "server.py"]
 
1
  FROM python:3.10-slim
2
 
 
3
  RUN apt-get update && apt-get install -y \
4
  libnss3 \
5
  libnspr4 \
 
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", "server.py"]
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- #gradio[mcp]
2
  textblob
3
  fastapi==0.104.1
4
  uvicorn==0.24.0
 
1
+ gradio[mcp]
2
  textblob
3
  fastapi==0.104.1
4
  uvicorn==0.24.0