Pamudu13 commited on
Commit
8606016
·
verified ·
1 Parent(s): 7def11a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -3
Dockerfile CHANGED
@@ -1,13 +1,29 @@
 
1
  FROM python:3.9
2
 
 
3
  RUN useradd -m -u 1000 user
4
 
 
5
  WORKDIR /app
6
 
 
7
  COPY --chown=user ./requirements.txt requirements.txt
8
-
9
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
10
 
11
- COPY --chown=user . /app
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- CMD ["uvicorn", "app:app","--no-access-log", "--host", "0.0.0.0", "--port", "7860"]
 
 
1
+ # Use the official Python image from the Docker Hub
2
  FROM python:3.9
3
 
4
+ # Create a non-root user
5
  RUN useradd -m -u 1000 user
6
 
7
+ # Set the working directory in the container
8
  WORKDIR /app
9
 
10
+ # Copy the requirements file and install dependencies
11
  COPY --chown=user ./requirements.txt requirements.txt
 
12
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
+ # Copy the application code into the container
15
+ COPY --chown=user . .
16
+
17
+ # Switch to the non-root user
18
+ USER user
19
+
20
+ # Set environment variable for Flask
21
+ ENV FLASK_APP=app.py
22
+ ENV FLASK_RUN_HOST=0.0.0.0
23
+ ENV FLASK_RUN_PORT=5000
24
+
25
+ # Expose the port the app runs on
26
+ EXPOSE 5000
27
 
28
+ # Command to run the application
29
+ CMD ["flask", "run"]