Download Dockerfile from wegag/max_ai: direct link, hf CLI and curl.
- Browser
- Download file 1.97 kB
-
https://huggingface.co/spaces/wegag/max_ai/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/wegag/max_ai/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/wegag/max_ai/resolve/main/Dockerfile
1.97 kB
| # Use the official Python image as a parent image | |
| FROM python:3.10-slim | |
| # Set environment variables for non-interactive installation | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| ENV XDG_CACHE_HOME=/tmp/.cache | |
| # Install system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| ffmpeg \ | |
| unzip \ | |
| imagemagick \ | |
| libx11-dev \ | |
| libxtst6 \ | |
| libjpeg-dev \ | |
| zlib1g-dev \ | |
| libsm6 \ | |
| libxext6 \ | |
| && 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 usage | |
| RUN 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 group | |
| RUN addgroup --system appgroup && adduser --system appuser --ingroup appgroup | |
| # Set the working directory in the container | |
| WORKDIR /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 zip file to the container | |
| COPY max_ai.zip ./ | |
| # Unzip the file and install Python dependencies | |
| RUN unzip max_ai.zip | |
| WORKDIR /app/max_ai | |
| RUN pip install --upgrade pip && \ | |
| pip install -r requirements.txt | |
| # Install additional Python packages | |
| RUN pip install gradio moviepy==1.0.3 openai-whisper flask gunicorn | |
| # 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 | |
| RUN echo "IMAGEMAGICK_BINARY = '/usr/bin/convert'" >> /usr/local/lib/python3.10/site-packages/moviepy/config.py | |
| # Switch to the non-root user | |
| USER appuser | |
| # Expose the port Gradio will run on | |
| EXPOSE 7860 | |
| COPY gradio_app.py /app/max_ai | |
| COPY flask_app.py /app/max_ai | |
| # Command to run the Gradio app | |
| CMD ["python", "flask_app.py"] | |