Create Dockerfile
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475# Use the official Python image as a parent imageFROM python:3.10-slim
# Set environment variables for non-interactive installationENV DEBIAN_FRONTEND=noninteractiveENV XDG_CACHE_HOME=/tmp/.cache
# Install system dependenciesRUN apt-get update && \ apt-get install -y \ ffmpeg \ unzip \ imagemagick \ libx11-dev \ libxtst6 \ && rm -rf /var/lib/apt/lists/*
# Install Arial fonts (including bold)RUN apt-get update && apt-get install -y \ fonts-liberation
# Modify ImageMagick's security policy to allow @ symbol usageRUN sed -i 's/<policy domain="path" rights="none" pattern="@\*"/<!-- <policy domain="path" rights="none" pattern="@\*" -->/' /etc/ImageMagick-6/policy.xml
# Create a non-root user and groupRUN addgroup --system appgroup && adduser --system appuser --ingroup appgroup
# Set the working directory in the containerWORKDIR /app
# Create the /tmp/.cache/whisper directory, give full permissions (777)RUN mkdir -p /tmp/.cache/whisper && \ chmod -R 777 /tmp/.cache/whisper
# Copy the Flask app and Gunicorn launcher script#COPY flask_app.py ./
# Copy the zip file to the containerCOPY max_ai.zip ./
# Unzip the file and install Python dependenciesRUN unzip max_ai.zip && \ cd max_ai && \ pip install --upgrade pip && \ pip install -r requirements.txt
# Install additional Python packagesRUN pip install gunicorn flask moviepy google_auth_oauthlib google-api-python-client google-auth-httplib2
# Fix the issue with PIL.Image.ANTIALIAS in moviepyRUN [ -f /usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py ] && \ sed -i 's/Image.ANTIALIAS/Image.LANCZOS/g' /usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py || \ echo "resize.py not found, skipping sed command"
# Set ImageMagick binary path in MoviePy config (Linux-based)RUN echo "IMAGEMAGICK_BINARY = '/usr/bin/convert'" >> /usr/local/lib/python3.10/site-packages/moviepy/config.py
# Install additional Python packages#RUN pip install gunicorn flask moviepy google_auth_oauthlib google-api-python-client google-auth-httplib2
# Fix the issue with PIL.Image.ANTIALIAS in moviepy#RUN sed -i 's/Image.ANTIALIAS/Image.LANCZOS/g' /usr/local/lib/python3.10/site-packages/moviepy/video/fx/resize.py
# Set ImageMagick binary path in MoviePy config (Linux-based)#RUN echo "IMAGEMAGICK_BINARY = '/usr/bin/convert'" >> /usr/local/lib/python3.10/site-packages/moviepy/config.py
# Switch to the non-root userUSER appuser
# Expose the port Gunicorn will run onEXPOSE 10000
# Command to run Gunicorn directlyCMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:10000", "flask_app:app"]DockerfileAdded+75