AiDeveloper1 commited on
Commit
d6e696c
·
verified ·
1 Parent(s): 05b676a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -9
Dockerfile CHANGED
@@ -1,14 +1,16 @@
1
- # Use official Python image
2
  FROM python:3.10-slim
3
 
4
  # Set environment variables
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
 
 
 
8
  # Set working directory
9
  WORKDIR /app
10
 
11
- # Install system dependencies for Playwright
12
  RUN apt-get update && apt-get install -y \
13
  wget \
14
  curl \
@@ -30,19 +32,18 @@ RUN apt-get update && apt-get install -y \
30
  xdg-utils \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- # Copy requirements and install Python dependencies
34
  COPY requirements.txt .
35
  RUN pip install --upgrade pip && pip install -r requirements.txt
36
 
37
- # Install Playwright browsers
38
- RUN pip install --no-cache-dir playwright && \
39
- playwright install chromium
40
 
41
- # Copy application files
42
  COPY . .
43
 
44
- # Expose port (Hugging Face uses port 7860 or 8000 typically)
45
  EXPOSE 7860
46
 
47
- # Command to run the app
48
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
  FROM python:3.10-slim
2
 
3
  # Set environment variables
4
  ENV PYTHONDONTWRITEBYTECODE=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
+ # Set this so Playwright installs browsers to a predictable location
8
+ ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
9
+
10
  # Set working directory
11
  WORKDIR /app
12
 
13
+ # Install system dependencies required for Chromium
14
  RUN apt-get update && apt-get install -y \
15
  wget \
16
  curl \
 
32
  xdg-utils \
33
  && rm -rf /var/lib/apt/lists/*
34
 
35
+ # Copy and install Python dependencies
36
  COPY requirements.txt .
37
  RUN pip install --upgrade pip && pip install -r requirements.txt
38
 
39
+ # Install Playwright and browsers to the correct path
40
+ RUN playwright install --with-deps
 
41
 
42
+ # Copy app code
43
  COPY . .
44
 
45
+ # Expose port (adjust if needed)
46
  EXPOSE 7860
47
 
48
+ # Run your app
49
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]