etukurudinesh commited on
Commit
20e40f1
·
1 Parent(s): 1657b1d

fix: docker test

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -20
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  FROM python:3.10-slim
2
 
3
- # Install system dependencies for Playwright
4
  RUN apt-get update && apt-get install -y \
5
  libnss3 \
6
  libnspr4 \
@@ -11,35 +11,46 @@ RUN apt-get update && apt-get install -y \
11
  libxcomposite1 \
12
  libxdamage1 \
13
  libxrandr2 \
14
- libgbm-dev \
15
  libgtk-3-0 \
16
- xdg-utils \
17
  libasound2 \
18
- mc \
 
 
 
 
 
 
 
 
19
  && rm -rf /var/lib/apt/lists/*
20
 
 
 
 
 
 
 
21
  RUN useradd -m -u 1000 user
22
  USER user
23
  ENV HOME=/home/user \
24
- PATH=/home/user/.local/bin:$PATH
 
 
 
 
 
 
25
 
26
  WORKDIR /app
27
 
28
- COPY --chown=user ./requirements.txt requirements.txt
29
-
30
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
31
- # Install Playwright browsers
32
- RUN pip install playwright
33
- RUN playwright install --with-deps
34
-
35
- RUN pip install --no-cache-dir "gradio[mcp]"
36
 
37
- ENV 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
- COPY --chown=user . /app
44
- #CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
45
  CMD ["python", "server.py"]
 
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
  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"]