Update Dockerfile
Browse files- Dockerfile +6 -14
Dockerfile
CHANGED
@@ -1,7 +1,5 @@
|
|
1 |
-
# Use Python 3.9 slim image for smaller size
|
2 |
FROM python:3.9-slim
|
3 |
|
4 |
-
# Set working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
# Install system dependencies
|
@@ -9,24 +7,18 @@ RUN apt-get update && apt-get install -y \
|
|
9 |
ffmpeg \
|
10 |
&& rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
# Copy requirements first to leverage Docker cache
|
13 |
COPY requirements.txt .
|
14 |
-
|
15 |
-
# Install Python dependencies
|
16 |
RUN pip install --no-cache-dir -r requirements.txt
|
17 |
|
18 |
-
# Copy application code
|
19 |
COPY . .
|
20 |
|
21 |
-
# Create directories
|
22 |
RUN mkdir -p /app/images /app/videos
|
23 |
|
24 |
-
#
|
25 |
ENV PYTHONUNBUFFERED=1
|
26 |
-
ENV
|
27 |
-
|
28 |
-
# Expose port
|
29 |
-
EXPOSE 8080
|
30 |
|
31 |
-
#
|
32 |
-
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "1", "--threads", "
|
|
|
|
|
1 |
FROM python:3.9-slim
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
# Install system dependencies
|
|
|
7 |
ffmpeg \
|
8 |
&& rm -rf /var/lib/apt/lists/*
|
9 |
|
|
|
10 |
COPY requirements.txt .
|
|
|
|
|
11 |
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
|
|
|
13 |
COPY . .
|
14 |
|
15 |
+
# Create necessary directories
|
16 |
RUN mkdir -p /app/images /app/videos
|
17 |
|
18 |
+
# Environment variables
|
19 |
ENV PYTHONUNBUFFERED=1
|
20 |
+
ENV FLASK_ENV=production
|
21 |
+
ENV FLASK_APP=app.py
|
|
|
|
|
22 |
|
23 |
+
# Use gthread worker for better performance
|
24 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--worker-class", "gthread", "--workers", "1", "--threads", "4", "--timeout", "0", "app:app"]
|