Shima92 commited on
Commit
ca892d5
·
1 Parent(s): 7acf0e2
Files changed (2) hide show
  1. Dockerfile +31 -12
  2. sidekick_tools.py +1 -1
Dockerfile CHANGED
@@ -1,21 +1,40 @@
1
- # Use an official Python runtime as a base image
2
- FROM python:3.10-slim
3
 
4
- # Set the working directory inside the container
5
- WORKDIR /usr/src/app
6
 
7
- # Copy the requirements file and install dependencies
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  COPY requirements.txt .
9
  RUN pip install --no-cache-dir -r requirements.txt
10
 
11
- # Copy the rest of your application code
 
 
 
 
12
  COPY . .
13
 
14
- # Expose the port your application will listen on
15
  EXPOSE 7860
16
 
17
- # Set the environment variable to ensure Gradio listens on all network interfaces
18
- ENV GRADIO_SERVER_NAME="0.0.0.0"
19
-
20
- # Define the command to run your application
21
- CMD ["python", "app.py"]
 
1
+ FROM python:3.11-slim
 
2
 
3
+ WORKDIR /app
 
4
 
5
+ # Install system dependencies for Playwright
6
+ RUN apt-get update && apt-get install -y \
7
+ wget \
8
+ gnupg \
9
+ ca-certificates \
10
+ fonts-liberation \
11
+ libappindicator3-1 \
12
+ libasound2 \
13
+ libatk-bridge2.0-0 \
14
+ libatk1.0-0 \
15
+ libcups2 \
16
+ libdbus-1-3 \
17
+ libgdk-pixbuf2.0-0 \
18
+ libnspr4 \
19
+ libnss3 \
20
+ libx11-xcb1 \
21
+ libxcomposite1 \
22
+ libxdamage1 \
23
+ libxrandr2 \
24
+ xdg-utils \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ # Copy requirements and install Python packages
28
  COPY requirements.txt .
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # Install Playwright browsers
32
+ RUN playwright install chromium
33
+ RUN playwright install-deps chromium
34
+
35
+ # Copy application files
36
  COPY . .
37
 
 
38
  EXPOSE 7860
39
 
40
+ CMD ["python", "app.py"]
 
 
 
 
sidekick_tools.py CHANGED
@@ -20,7 +20,7 @@ serper = GoogleSerperAPIWrapper()
20
 
21
  async def playwright_tools():
22
  playwright = await async_playwright().start()
23
- browser = await playwright.chromium.launch(headless=False)
24
  toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=browser)
25
  return toolkit.get_tools(), browser, playwright
26
 
 
20
 
21
  async def playwright_tools():
22
  playwright = await async_playwright().start()
23
+ browser = await playwright.chromium.launch(headless=True)
24
  toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=browser)
25
  return toolkit.get_tools(), browser, playwright
26