slimshadow commited on
Commit
93251c1
·
verified ·
1 Parent(s): 3f506ec

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a specific Python version as the base image
2
+ FROM python:3.9
3
+
4
+ # Create a user with a specific UID and switch to that user
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+
8
+ # Set the PATH environment variable
9
+ ENV PATH="/home/user/.local/bin:$PATH"
10
+
11
+ # Set the working directory
12
+ WORKDIR /app
13
+
14
+ # Copy and install dependencies
15
+ COPY --chown=user ./requirements.txt requirements.txt
16
+ RUN pip install --no-cache-dir --upgrade pip setuptools \
17
+ && pip install --no-cache-dir --upgrade -r requirements.txt
18
+
19
+ # Copy the rest of the application code
20
+ COPY --chown=user . /app
21
+
22
+ # Define the command to run the Flask application
23
+ CMD ["flask", "run", "--host=0.0.0.0", "--port=7860"]
24
+
25
+ # Optional: Expose the port (not required but good practice)
26
+ EXPOSE 7860
27
+
28
+ # Add a HEALTHCHECK to monitor the server's status
29
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
30
+ CMD curl -f http://localhost:7860/health || exit 1