srivatsavdamaraju commited on
Commit
e3f5fbb
·
verified ·
1 Parent(s): 5aca3a8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -12
Dockerfile CHANGED
@@ -1,20 +1,28 @@
1
- # Step 1: Use an official Python runtime as a parent image
2
- FROM python:3.10-slim
3
 
4
- # Step 2: Set the working directory in the container
5
  WORKDIR /app
6
 
7
- # Step 3: Copy the current directory contents into the container at /app
8
  COPY . /app
9
 
10
- # Step 4: Install any needed packages specified in requirements.txt
11
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
12
 
13
- # Step 5: Expose the port the app runs on
14
- EXPOSE 5000
 
15
 
16
- # Step 6: Define environment variable
17
- ENV FLASK_APP=app.py
18
 
19
- # Step 7: Run Gunicorn to serve the app
20
- CMD ["gunicorn", "-b", "0.0.0.0:5000", "app:app"]
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.8-slim
3
 
4
+ # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Copy the current directory contents into the container at /app
8
  COPY . /app
9
 
10
+ # Install system dependencies
11
+ RUN apt-get update && \
12
+ apt-get install -y \
13
+ python3-opencv \
14
+ libglib2.0-0 \
15
+ libsm6 \
16
+ libxext6 \
17
+ libxrender-dev \
18
+ && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Install dependencies from requirements.txt
21
+ RUN pip install --upgrade pip
22
+ RUN pip install -r requirements.txt
23
 
24
+ # Expose port 7860 for Hugging Face Spaces (default port for web apps)
25
+ EXPOSE 7860
26
 
27
+ # Command to run the application using Gunicorn with multiple threads
28
+ CMD ["gunicorn", "-b", "0.0.0.0:7860", "--threads", "6", "app:app"]