neonwatty commited on
Commit
44ccc4d
·
verified ·
1 Parent(s): e87efd1

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use Python 3.11 as base image
2
+ FROM python:3.11
3
+
4
+ # Set up a new user named "user" with user ID 1000 (as recommended by HF)
5
+ RUN useradd -m -u 1000 user
6
+
7
+ # Switch to the "user" user
8
+ USER user
9
+
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
+
14
+ # Set the working directory to the user's home directory
15
+ WORKDIR $HOME/app
16
+
17
+ # Install Docker
18
+ RUN sudo apt-get update && \
19
+ sudo apt-get install -y \
20
+ apt-transport-https \
21
+ ca-certificates \
22
+ curl \
23
+ gnupg \
24
+ lsb-release && \
25
+ curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
26
+ echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
27
+ sudo apt-get update && \
28
+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
29
+
30
+ # Install Python dependencies
31
+ COPY --chown=user requirements.txt .
32
+ RUN pip install --no-cache-dir --upgrade pip && \
33
+ pip install --no-cache-dir -r requirements.txt
34
+
35
+ # Copy the application files
36
+ COPY --chown=user . .
37
+
38
+ # Expose the port that Gradio will run on
39
+ EXPOSE 7860
40
+
41
+ # Run the application
42
+ CMD ["python", "app.py"]