diff --git a/Dockerfile b/Dockerfile index 85d49a1..c84c342 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,52 @@ -FROM python:3.12 - -RUN apt-get update && \ - apt-get install -y bash curl && \ - rm -rf /var/lib/apt/lists/* - -RUN curl -sSL https://install.python-poetry.org | python3 - +FROM python:3-alpine WORKDIR /app COPY . /app +# Install Poetry +RUN set -eux; \ + apk add --no-cache curl; \ + \ + curl -sSL https://install.python-poetry.org | python3 - + ENV PATH="/root/.local/bin:$PATH" -RUN bash ./tools/install-deps.sh && \ - poetry install +# Build GPAC and Bento4 +RUN set -eux; \ + apk add --no-cache git g++ make cmake zlib-dev coreutils; \ + \ + # Build and install GPAC + \ + git clone --depth=1 https://github.com/gpac/gpac.git ./build/gpac || exit 1; \ + cd ./build/gpac; \ + ./configure; \ + make -j$(nproc); \ + make install; \ + MP4BOX_PATH=$(command -v MP4Box); \ + if [ -n "$MP4BOX_PATH" ]; then ln -sf "$MP4BOX_PATH" "$(dirname "$MP4BOX_PATH")/mp4box"; fi; \ + cd /app; \ + \ + # Build and install Bento4 + \ + git clone --depth=1 https://github.com/axiomatic-systems/Bento4.git ./build/Bento4 || exit 1; \ + mkdir -p ./build/Bento4/cmakebuild; \ + cd ./build/Bento4/cmakebuild; \ + cmake -DCMAKE_BUILD_TYPE=Release ..; \ + make -j$(nproc); \ + make install; \ + cd /app; \ + \ + # Clean up + \ + rm -rf ./build; \ + apk del git g++ make cmake zlib-dev coreutils; + +# Install Python dependencies +RUN set -eux; \ + apk add --no-cache ffmpeg; \ + \ + export PATH="/root/.local/bin:$PATH"; \ + poetry install; CMD ["poetry", "run", "python", "main.py"] \ No newline at end of file