NitinBot001 commited on
Commit
fa833f2
·
verified ·
1 Parent(s): 9a222ed

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -37
Dockerfile CHANGED
@@ -1,37 +1,37 @@
1
- # Use an official Python runtime as a parent image
2
- FROM python:3.11-slim
3
-
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE 1
6
- ENV PYTHONUNBUFFERED 1
7
- ENV FLASK_APP=server.py
8
- ENV FLASK_ENV=production
9
-
10
- # Set the working directory in the container
11
- WORKDIR /app
12
-
13
- # Install system dependencies required for some Python packages
14
- RUN apt-get update && apt-get install -y --no-install-recommends \
15
- gcc \
16
- python3-dev \
17
- && rm -rf /var/lib/apt/lists/*
18
-
19
- # Copy requirements first to leverage Docker cache
20
- COPY requirements.txt .
21
-
22
- # Install Python dependencies
23
- RUN pip install --no-cache-dir -r requirements.txt
24
-
25
- # Create a non-root user and switch to it
26
- RUN groupadd -r appuser && useradd -r -g appuser appuser
27
- RUN chown -R appuser:appuser /app
28
- USER appuser
29
-
30
- # Copy the rest of the application
31
- COPY --chown=appuser:appuser . .
32
-
33
- # Expose the port the app runs on
34
- EXPOSE 8082
35
-
36
- # Command to run the application
37
- CMD ["gunicorn", "--bind", "0.0.0.0:8082", "--workers", "4", "--threads", "2", "server:app"]
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE 1
6
+ ENV PYTHONUNBUFFERED 1
7
+ ENV FLASK_APP=server.py
8
+ ENV FLASK_ENV=production
9
+
10
+ # Set the working directory in the container
11
+ WORKDIR /app
12
+
13
+ # Install system dependencies required for some Python packages
14
+ RUN apt-get update && apt-get install -y --no-install-recommends \
15
+ gcc \
16
+ python3-dev \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Copy requirements first to leverage Docker cache
20
+ COPY requirements.txt .
21
+
22
+ # Install Python dependencies
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Create a non-root user and switch to it
26
+ RUN groupadd -r appuser && useradd -r -g appuser appuser
27
+ RUN chown -R appuser:appuser /app
28
+ USER appuser
29
+
30
+ # Copy the rest of the application
31
+ COPY --chown=appuser:appuser . .
32
+
33
+ # Expose the port the app runs on
34
+ EXPOSE 8082
35
+
36
+ # Command to run the application
37
+ CMD ["python", "server.py"]