derricka59 commited on
Commit
414fd1a
·
verified ·
1 Parent(s): 317d95a

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the recommended Python base image
2
+ FROM python:3.9
3
+
4
+ # Create a non-root user
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+
8
+ # Set environment variables
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+ WORKDIR /app
11
+
12
+ # Copy and install requirements
13
+ # Using --chown=user to ensure the user owns the files
14
+ COPY --chown=user ./requirements.txt requirements.txt
15
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
16
+
17
+ # Copy the rest of the application code
18
+ COPY --chown=user . /app
19
+
20
+ # Expose the correct port for Hugging Face Spaces
21
+ EXPOSE 7860
22
+
23
+ # Command to run the Uvicorn server
24
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]