mdnazib963 commited on
Commit
9c27d7d
·
verified ·
1 Parent(s): 385db80

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python image
2
+ FROM python:3.10-slim
3
+
4
+ # Set up a new user named "user" with user ID 1000
5
+ # Hugging Face Spaces require running as a non-root user for security
6
+ RUN useradd -m -u 1000 user
7
+
8
+ # Install system dependencies required for Playwright/Chromium
9
+ RUN apt-get update && apt-get install -y \
10
+ wget \
11
+ gnupg \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Switch to the "user" user
15
+ USER user
16
+
17
+ # Set home to the user's home directory
18
+ ENV HOME=/home/user \
19
+ PATH=/home/user/.local/bin:$PATH
20
+
21
+ # Set the working directory to the user's home directory
22
+ WORKDIR $HOME/app
23
+
24
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
25
+ COPY --chown=user . $HOME/app
26
+
27
+ # Install Python dependencies
28
+ RUN pip install --no-cache-dir --upgrade pip
29
+ RUN pip install --no-cache-dir -r requirements.txt
30
+
31
+ # Install Playwright and the Chromium browser
32
+ # We use the specific "chromium" install to save space vs full browser list
33
+ RUN playwright install chromium
34
+
35
+ # Start the application
36
+ CMD ["python", "app.py"]