rootp1 commited on
Commit
8793eed
·
verified ·
1 Parent(s): 272eb13

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python image
2
+ FROM python:3.9
3
+
4
+ # Create a non-root user
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+ ENV PATH="/home/user/.local/bin:$PATH"
8
+
9
+ # Set working directory
10
+ WORKDIR /app
11
+
12
+ # Copy requirements and install as non-root
13
+ COPY --chown=user ./requirements.txt requirements.txt
14
+ RUN pip install --no-cache-dir --upgrade pip
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Copy app source code
18
+ COPY --chown=user . /app
19
+
20
+ # Expose port (match the Flask port or environment variable)
21
+ EXPOSE 5000
22
+
23
+ # Run Flask app using gunicorn for production (safer than Flask dev server)
24
+ CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app", "--workers", "2"]