-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.performance
More file actions
79 lines (64 loc) · 2.28 KB
/
Dockerfile.performance
File metadata and controls
79 lines (64 loc) · 2.28 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# High-Performance Dockerfile for maximum resource utilization
FROM python:3.11-slim
# Install system dependencies with full optimization support
RUN apt-get update && apt-get install -y \
ffmpeg \
imagemagick \
fonts-dejavu \
fonts-liberation \
git \
curl \
build-essential \
wget \
unzip \
htop \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean \
&& sed -i 's/policy domain="path" rights="none" pattern="@\*"/policy domain="path" rights="read" pattern="@*"/' /etc/ImageMagick-7/policy.xml
# Install additional performance fonts
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
COPY requirements.txt optimized_requirements.txt ./
# Install Python dependencies with performance optimizations
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir -r optimized_requirements.txt \
&& pip cache purge
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p temp uploads jobs static performance_charts
# Set environment variables for maximum performance
ENV FLASK_APP=app_performance.py
ENV FLASK_ENV=production
ENV PYTHONPATH=/app
ENV PORT=8080
# Performance optimization environment variables
ENV OMP_NUM_THREADS=4
ENV MKL_NUM_THREADS=4
ENV VECLIB_MAXIMUM_THREADS=4
ENV NUMEXPR_NUM_THREADS=4
# PyTorch optimizations
ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:1024
# Performance mode flags
ENV PERFORMANCE_MODE=HIGH
ENV MAX_MEMORY_USAGE=90
ENV USE_ALL_CORES=true
# Expose port
EXPOSE 8080
# Enhanced health check for performance version
HEALTHCHECK --interval=30s --timeout=20s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 1
# Labels for performance container
LABEL maintainer="VideoEditorAPI"
LABEL version="performance-v1.0"
LABEL description="High-performance VideoEditorAPI using all system resources"
LABEL performance.mode="maximum"
LABEL performance.optimization="parallel-processing"
LABEL performance.resource_usage="maximum"
# Run the high-performance application
CMD ["python", "app_performance.py"]