heisbuba commited on
Commit
0f1d3e7
·
verified ·
1 Parent(s): a3b0cc4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -6
Dockerfile CHANGED
@@ -1,8 +1,34 @@
1
- FROM python:3.9
2
- WORKDIR /code
3
- COPY . .
 
 
 
 
 
 
 
 
 
 
 
4
  RUN pip install --no-cache-dir -r requirements.txt
5
- RUN mkdir -p /tmp
6
- RUN chmod 777 /tmp
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  EXPOSE 7860
8
- CMD ["gunicorn", "-b", "0.0.0.0:7860", "app:app"]
 
 
 
1
+ # Use the official Python image
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies required for Playwright
8
+ RUN apt-get update && apt-get install -y \
9
+ wget \
10
+ gnupg \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements and install Python packages
14
+ COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Install Playwright Browsers (Chromium) and System Dependencies
18
+ RUN playwright install chromium
19
+ RUN playwright install-deps chromium
20
+
21
+ # Copy the rest of the application
22
+ COPY . .
23
+
24
+ # Create a non-root user (Hugging Face Security Requirement)
25
+ RUN useradd -m -u 1000 user
26
+ USER user
27
+ ENV HOME=/home/user \
28
+ PATH=/home/user/.local/bin:$PATH
29
+
30
+ # Expose the port
31
  EXPOSE 7860
32
+
33
+ # Run the application
34
+ CMD ["python", "app.py"]