DrekFretson commited on
Commit
4a1006b
·
verified ·
1 Parent(s): c440d6c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +43 -0
Dockerfile ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10
2
+
3
+ WORKDIR /code
4
+
5
+ COPY ./requirements.txt /code/requirements.txt
6
+
7
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
+
9
+ RUN apt update -y
10
+
11
+ RUN apt install ffmpeg -y
12
+
13
+ RUN pip install gradio[oauth]
14
+
15
+ # Install Playwright and download the required browsers
16
+ RUN playwright install --with-deps
17
+
18
+ # Set up a new user named "user" with user ID 1000
19
+ RUN useradd -m -u 1000 user
20
+ # Switch to the "user" user
21
+ USER user
22
+ # Set home to the user's home directory
23
+ ENV HOME=/home/user \
24
+ PATH=/home/user/.local/bin:$PATH \
25
+ PYTHONPATH=$HOME/app \
26
+ PYTHONUNBUFFERED=1 \
27
+ GRADIO_ALLOW_FLAGGING=never \
28
+ GRADIO_NUM_PORTS=1 \
29
+ GRADIO_SERVER_NAME=0.0.0.0 \
30
+ GRADIO_THEME=huggingface \
31
+ SYSTEM=spaces
32
+
33
+ # Ensure Playwright browsers are installed for the non-root user
34
+ RUN playwright install
35
+ RUN playwright install chromium
36
+
37
+ # Set the working directory to the user's home directory
38
+ WORKDIR $HOME/app
39
+
40
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
41
+ COPY --chown=user . $HOME/app
42
+
43
+ CMD ["python", "app.py"]