srivatsavdamaraju commited on
Commit
8161e41
1 Parent(s): 2d3586a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -20
Dockerfile CHANGED
@@ -1,35 +1,33 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim
3
 
4
- # Install system dependencies for OpenCV, including libGL.so.1 and others
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
 
 
 
6
  libgl1-mesa-glx \
7
  libglib2.0-0 \
8
- libsm6 \
9
- libxext6 \
10
- libxrender1 \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Set the working directory in the container
14
  WORKDIR /app
15
 
16
- # Create a new directory for Torch cache
17
- RUN mkdir -p /app/.cache/torch
18
-
19
- # Set environment variable to use the new cache location
20
- ENV TORCH_HOME=/app/.cache/torch
21
-
22
- # Copy the current directory contents into the container at /app
23
- COPY . /app
24
 
25
- # Install any needed packages specified in requirements.txt
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # Install Gunicorn
29
- RUN pip install gunicorn
30
 
31
- # Expose the port the app runs on
32
  EXPOSE 5000
33
 
34
- # Run the Gunicorn server when the container launches
35
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "app:app"]
 
1
+ # Step 1: Use an official Python base image
2
  FROM python:3.9-slim
3
 
4
+ # Step 2: Set environment variables to prevent Python from writing .pyc files and to ensure the app runs in the background
5
+ ENV PYTHONDONTWRITEBYTECODE 1
6
+ ENV PYTHONUNBUFFERED 1
7
+
8
+ # Step 3: Install system dependencies
9
  RUN apt-get update && apt-get install -y \
10
+ gcc \
11
+ g++ \
12
+ make \
13
  libgl1-mesa-glx \
14
  libglib2.0-0 \
 
 
 
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Step 4: Set the working directory inside the container
18
  WORKDIR /app
19
 
20
+ # Step 5: Copy the requirements file into the container
21
+ COPY requirements.txt /app/
 
 
 
 
 
 
22
 
23
+ # Step 6: Install the Python dependencies
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
+ # Step 7: Copy the rest of the application files into the container
27
+ COPY . /app/
28
 
29
+ # Step 8: Expose the port that the Flask app will run on
30
  EXPOSE 5000
31
 
32
+ # Step 9: Set the entry point to start the Flask application
33
+ CMD ["python", "app.py"]