Anonymusmee commited on
Commit
19145ad
·
verified ·
1 Parent(s): 0c58a07

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a stable Python base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies needed for libraries like OpenCV or Pillow
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ ffmpeg \
10
+ libsm6 \
11
+ libxext6 \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Copy the requirements file first to leverage Docker's layer caching
15
+ COPY requirements.txt .
16
+
17
+ # Install Python dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy the rest of the application files into the container
21
+ COPY . .
22
+
23
+ # Create a directory for the generated files
24
+ RUN mkdir -p /app/generated
25
+
26
+ # Expose the port the app will run on
27
+ EXPOSE 5000
28
+
29
+ # Command to run the application using Gunicorn, a production-grade server
30
+ # The timeout is increased because the AI model can take a long time to respond.
31
+ CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "1", "--timeout", "300", "app:app"]