Arkm20 commited on
Commit
3f03678
·
verified ·
1 Parent(s): 14c25b5

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory in the container
5
+ WORKDIR /app
6
+
7
+ # Prevent python from writing pyc files to disc
8
+ ENV PYTHONDONTWRITEBYTECODE 1
9
+ # Prevent python from buffering stdout and stderr
10
+ ENV PYTHONUNBUFFERED 1
11
+
12
+ # Create a non-root user
13
+ RUN useradd -m -u 1000 user
14
+ USER user
15
+ ENV PATH="/home/user/.local/bin:$PATH"
16
+
17
+ # Install dependencies
18
+ COPY --chown=user ./requirements.txt requirements.txt
19
+ RUN pip install --no-cache-dir --user --upgrade -r requirements.txt
20
+
21
+ # Copy the application code
22
+ COPY --chown=user . .
23
+
24
+ # Expose the port the app runs on
25
+ EXPOSE 7860
26
+
27
+ # Command to run the application
28
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]