topsecrettraders commited on
Commit
c4bf025
·
verified ·
1 Parent(s): be8c727

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -0
Dockerfile ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python 3.9 image
2
+ FROM python:3.9
3
+
4
+ # Set up a new user named "user" with user ID 1000
5
+ # Hugging Face requires a non-root user for security
6
+ RUN useradd -m -u 1000 user
7
+
8
+ # Switch to the "user" user
9
+ USER user
10
+
11
+ # Set environment variables
12
+ ENV HOME=/home/user \
13
+ PATH=/home/user/.local/bin:$PATH
14
+
15
+ # Set the working directory to the user's home directory
16
+ WORKDIR $HOME/app
17
+
18
+ # Copy the current directory contents into the container at $HOME/app
19
+ # We use --chown=user to ensure the new user owns the files
20
+ COPY --chown=user . $HOME/app
21
+
22
+ # Install any needed packages specified in requirements.txt
23
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
24
+
25
+ # Make port 7860 available to the world outside this container
26
+ EXPOSE 7860
27
+
28
+ # Run app.py when the container launches
29
+ CMD ["python", "app.py"]