pvanand commited on
Commit
fe9dddd
·
verified ·
1 Parent(s): 964965b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -12
Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
- # Use the official Python 3.10.9 image as the base
2
- FROM python:3.10.9
3
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y
 
 
9
 
10
  # Copy the requirements file into the container
11
  COPY requirements.txt .
@@ -13,11 +15,29 @@ COPY requirements.txt .
13
  # Install Python dependencies
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
 
16
- # Install Playwright browsers
17
- RUN playwright install deps
18
-
19
- # Create the .crawl4ai directory with correct permissions
20
- RUN mkdir /.crawl4ai && chmod 777 /.crawl4ai
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # Copy the current directory contents into the container
23
  COPY . .
@@ -28,8 +48,5 @@ RUN chmod -R 755 /app
28
  # Expose the port the app runs on
29
  EXPOSE 8000
30
 
31
- # Set environment variable to use the created directory
32
- ENV CRAWL4AI_DB_PATH=/.crawl4ai
33
-
34
  # Command to run the FastAPI application
35
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Playwright Python image
2
+ FROM mcr.microsoft.com/playwright/python:v1.21.0-focal
3
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Set environment variables
8
+ ENV PYTHONDONTWRITEBYTECODE=1
9
+ ENV PYTHONUNBUFFERED=1
10
+ ENV PLAYWRIGHT_BROWSERS_PATH=/app/ms-playwright
11
 
12
  # Copy the requirements file into the container
13
  COPY requirements.txt .
 
15
  # Install Python dependencies
16
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
+ # Install Playwright and its dependencies
19
+ RUN playwright install --with-deps chromium
20
+
21
+ # Install additional system dependencies if needed
22
+ RUN apt-get update && apt-get install -y \
23
+ gconf-service \
24
+ libasound2 \
25
+ libatk1.0-0 \
26
+ libcairo2 \
27
+ libcups2 \
28
+ libfontconfig1 \
29
+ libgdk-pixbuf2.0-0 \
30
+ libgtk-3-0 \
31
+ libnspr4 \
32
+ libpango-1.0-0 \
33
+ libxss1 \
34
+ fonts-liberation \
35
+ libappindicator1 \
36
+ libnss3 \
37
+ lsb-release \
38
+ xdg-utils \
39
+ && apt-get clean \
40
+ && rm -rf /var/lib/apt/lists/*
41
 
42
  # Copy the current directory contents into the container
43
  COPY . .
 
48
  # Expose the port the app runs on
49
  EXPOSE 8000
50
 
 
 
 
51
  # Command to run the FastAPI application
52
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]