-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (42 loc) · 1.41 KB
/
Dockerfile
File metadata and controls
53 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Use Python 3.11 slim image
FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
imagemagick \
fonts-dejavu \
fonts-liberation \
git \
curl \
build-essential \
wget \
unzip \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/policy domain="path" rights="none" pattern="@\*"/policy domain="path" rights="read" pattern="@*"/' /etc/ImageMagick-7/policy.xml
# Download and install Luckiest Guy font
RUN mkdir -p /usr/share/fonts/truetype/luckiest-guy \
&& wget -O /usr/share/fonts/truetype/luckiest-guy/LuckiestGuy-Regular.ttf \
"https://github.com/google/fonts/raw/main/apache/luckiestguy/LuckiestGuy-Regular.ttf" \
&& fc-cache -f -v
# Set working directory
WORKDIR /app
# Copy requirements first for better caching
COPY requirements.txt optimized_requirements.txt ./
# Install Python dependencies (including optimization dependencies)
RUN pip install --no-cache-dir -r optimized_requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p temp uploads jobs static
# Set environment variables
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV PYTHONPATH=/app
ENV PORT=8080
# Expose port
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Run the unified application
CMD ["python", "app.py"]