Mr-Thop commited on
Commit
d766f93
·
1 Parent(s): 5c1a5b8

YUpdate docker file

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -16
Dockerfile CHANGED
@@ -1,23 +1,22 @@
1
- # Use a specific Python version for consistency
2
- FROM python:3.9-slim as base
3
 
4
- # Set environment variables
5
- ENV PYTHONUNBUFFERED 1
6
- ENV PATH="/home/user/.local/bin:$PATH"
7
-
8
- # Create a non-root user
9
  RUN useradd -m -u 1000 user
 
10
 
11
- # Set working directory
 
 
 
12
  WORKDIR /app
13
 
14
- # Copy and install dependencies with proper permissions
15
- COPY --chown=user: user ./req.txt /app/req.txt
16
- USER user
17
- RUN pip install --no-cache-dir --upgrade -r /app/req.txt
18
 
19
- # Copy the application code (exclude unnecessary files using .dockerignore)
20
- COPY --chown=user: user . /app
21
 
22
- # Start the application using gunicorn
23
- CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860"]
 
1
+ # Starting from an official Python image
2
+ FROM python:3.9
3
 
4
+ # Creating a non-root user for security
 
 
 
 
5
  RUN useradd -m -u 1000 user
6
+ USER user
7
 
8
+ # Ensuring user's local bin is on PATH
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+
11
+ # Setting working directory inside container
12
  WORKDIR /app
13
 
14
+ # Installing Python dependencies
15
+ COPY --chown=user ./req.txt req.txt
16
+ RUN pip install --no-cache-dir --upgrade -r req.txt
 
17
 
18
+ # Copying the rest of your app code
19
+ COPY --chown=user . /app
20
 
21
+ # Starting the Flask app using gunicorn
22
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app","--timeout","120","--workers","1"]