| |
| FROM python:3.9-slim |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| ca-certificates \ |
| wget \ |
| tar \ |
| xz-utils \ |
| fonts-liberation \ |
| fontconfig \ |
| build-essential \ |
| yasm \ |
| cmake \ |
| meson \ |
| ninja-build \ |
| nasm \ |
| libssl-dev \ |
| libvpx-dev \ |
| libx264-dev \ |
| libx265-dev \ |
| libnuma-dev \ |
| libmp3lame-dev \ |
| libopus-dev \ |
| libvorbis-dev \ |
| libtheora-dev \ |
| libspeex-dev \ |
| libfreetype6-dev \ |
| libfontconfig1-dev \ |
| libgnutls28-dev \ |
| libaom-dev \ |
| libdav1d-dev \ |
| librav1e-dev \ |
| libsvtav1-dev \ |
| libzimg-dev \ |
| libwebp-dev \ |
| git \ |
| pkg-config \ |
| autoconf \ |
| automake \ |
| libtool \ |
| libfribidi-dev \ |
| libharfbuzz-dev \ |
| libnss3 \ |
| libatk1.0-0 \ |
| libatk-bridge2.0-0 \ |
| libcups2 \ |
| libxcomposite1 \ |
| libxrandr2 \ |
| libxdamage1 \ |
| libgbm1 \ |
| libasound2 \ |
| libpangocairo-1.0-0 \ |
| libpangoft2-1.0-0 \ |
| libgtk-3-0 \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN git clone https://github.com/Haivision/srt.git && \ |
| cd srt && \ |
| mkdir build && cd build && \ |
| cmake .. && \ |
| make -j$(nproc) && \ |
| make install && \ |
| cd ../.. && rm -rf srt |
| |
| |
| RUN git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git && \ |
| cd SVT-AV1 && \ |
| git checkout v0.9.0 && \ |
| cd Build && \ |
| cmake .. && \ |
| make -j$(nproc) && \ |
| make install && \ |
| cd ../.. && rm -rf SVT-AV1 |
|
|
| |
| RUN git clone https://github.com/Netflix/vmaf.git && \ |
| cd vmaf/libvmaf && \ |
| meson build --buildtype release && \ |
| ninja -C build && \ |
| ninja -C build install && \ |
| cd ../.. && rm -rf vmaf && \ |
| ldconfig |
| |
| |
| RUN git clone https://github.com/mstorsjo/fdk-aac && \ |
| cd fdk-aac && \ |
| autoreconf -fiv && \ |
| ./configure && \ |
| make -j$(nproc) && \ |
| make install && \ |
| cd .. && rm -rf fdk-aac |
|
|
| |
| RUN git clone https://github.com/adah1972/libunibreak.git && \ |
| cd libunibreak && \ |
| ./autogen.sh && \ |
| ./configure && \ |
| make -j$(nproc) && \ |
| make install && \ |
| ldconfig && \ |
| cd .. && rm -rf libunibreak |
| |
| |
| RUN git clone https://github.com/libass/libass.git && \ |
| cd libass && \ |
| autoreconf -i && \ |
| ./configure --enable-libunibreak || { cat config.log; exit 1; } && \ |
| mkdir -p /app && echo "Config log located at: /app/config.log" && cp config.log /app/config.log && \ |
| make -j$(nproc) || { echo "Libass build failed"; exit 1; } && \ |
| make install && \ |
| ldconfig && \ |
| cd .. && rm -rf libass |
|
|
| |
| RUN git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg && \ |
| cd ffmpeg && \ |
| git checkout n7.0.2 && \ |
| PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig" \ |
| CFLAGS="-I/usr/include/freetype2" \ |
| LDFLAGS="-L/usr/lib/x86_64-linux-gnu" \ |
| ./configure --prefix=/usr/local \ |
| --enable-gpl \ |
| --enable-pthreads \ |
| --enable-neon \ |
| --enable-libaom \ |
| --enable-libdav1d \ |
| --enable-librav1e \ |
| --enable-libsvtav1 \ |
| --enable-libvmaf \ |
| --enable-libzimg \ |
| --enable-libx264 \ |
| --enable-libx265 \ |
| --enable-libvpx \ |
| --enable-libwebp \ |
| --enable-libmp3lame \ |
| --enable-libopus \ |
| --enable-libvorbis \ |
| --enable-libtheora \ |
| --enable-libspeex \ |
| --enable-libass \ |
| --enable-libfreetype \ |
| --enable-libharfbuzz \ |
| --enable-fontconfig \ |
| --enable-libsrt \ |
| --enable-filter=drawtext \ |
| --extra-cflags="-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include" \ |
| --extra-ldflags="-L/usr/lib/x86_64-linux-gnu -lfreetype -lfontconfig" \ |
| --enable-gnutls \ |
| && make -j$(nproc) && \ |
| make install && \ |
| cd .. && rm -rf ffmpeg |
| |
| |
| ENV PATH="/usr/local/bin:${PATH}" |
| |
| |
| COPY ./fonts /usr/share/fonts/custom |
| |
| |
| RUN fc-cache -f -v |
| |
| |
| WORKDIR /app |
| |
| |
| ENV WHISPER_CACHE_DIR="/app/whisper_cache" |
| |
| |
| RUN mkdir -p ${WHISPER_CACHE_DIR} |
| |
| |
| COPY requirements.txt . |
| |
| |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir -r requirements.txt && \ |
| pip install openai-whisper && \ |
| pip install playwright && \ |
| pip install jsonschema |
| |
| |
| RUN useradd -m appuser |
| |
| |
| RUN chown appuser:appuser /app |
| |
| |
| USER appuser |
| |
| RUN python -c "import os; print(os.environ.get('WHISPER_CACHE_DIR')); import whisper; whisper.load_model('base')" |
| |
| |
| RUN playwright install chromium |
| |
| |
| COPY . . |
| |
| |
| EXPOSE 7860 |
| |
| |
| ENV PYTHONUNBUFFERED=1 |
| |
| RUN echo ' |
| gunicorn --bind 0.0.0.0:7860 \ |
| --workers ${GUNICORN_WORKERS:-2} \ |
| --timeout ${GUNICORN_TIMEOUT:-300} \ |
| --worker-class sync \ |
| --keep-alive 80 \ |
| app:app' > /app/run_gunicorn.sh && \ |
| chmod +x /app/run_gunicorn.sh |
| |
| |
| CMD ["/app/run_gunicorn.sh"] |