Skip to content
Snippets Groups Projects
Commit fd70f787 authored by Ahmet Öner's avatar Ahmet Öner
Browse files

Add FFmpeg compiling Docker stage

parent be0beb0a
Branches
No related tags found
No related merge requests found
FROM swaggerapi/swagger-ui:v5.9.1 AS swagger-ui FROM debian:bookworm-slim AS ffmpeg
FROM python:3.10-slim
ENV POETRY_VENV=/app/.venv
RUN export DEBIAN_FRONTEND=noninteractive \ RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \ && apt-get -qq update \
&& apt-get -qq install --no-install-recommends \ && apt-get -qq install --no-install-recommends \
ffmpeg \ build-essential \
git \
pkg-config \
yasm \
ca-certificates \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/FFmpeg/FFmpeg.git --depth 1 --branch n6.1.1 --single-branch /FFmpeg-6.1.1
WORKDIR /FFmpeg-6.1.1
RUN PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="$HOME/bin" \
--disable-doc \
--disable-htmlpages \
--disable-podpages \
--disable-txtpages \
--disable-network \
--disable-autodetect \
--disable-hwaccels \
--disable-ffprobe \
--disable-ffplay \
--enable-filter=copy \
--enable-protocol=file \
--enable-small && \
PATH="$HOME/bin:$PATH" make -j$(nproc) && \
make install && \
hash -r
FROM swaggerapi/swagger-ui:v5.9.1 AS swagger-ui
FROM python:3.10-bookworm
ENV POETRY_VENV=/app/.venv
RUN python3 -m venv $POETRY_VENV \ RUN python3 -m venv $POETRY_VENV \
&& $POETRY_VENV/bin/pip install -U pip setuptools \ && $POETRY_VENV/bin/pip install -U pip setuptools \
&& $POETRY_VENV/bin/pip install poetry==1.6.1 && $POETRY_VENV/bin/pip install poetry==1.6.1
...@@ -18,6 +53,8 @@ ENV PATH="${PATH}:${POETRY_VENV}/bin" ...@@ -18,6 +53,8 @@ ENV PATH="${PATH}:${POETRY_VENV}/bin"
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
COPY --from=ffmpeg /FFmpeg-6.1.1 /FFmpeg-6.1.1
COPY --from=ffmpeg /root/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js
......
FROM debian:bookworm-slim AS ffmpeg
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get -qq update \
&& apt-get -qq install --no-install-recommends \
build-essential \
git \
pkg-config \
yasm \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/FFmpeg/FFmpeg.git --depth 1 --branch n6.1.1 --single-branch /FFmpeg-6.1.1
WORKDIR /FFmpeg-6.1.1
RUN PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--ld="g++" \
--bindir="$HOME/bin" \
--disable-doc \
--disable-htmlpages \
--disable-podpages \
--disable-txtpages \
--disable-network \
--disable-autodetect \
--disable-hwaccels \
--disable-ffprobe \
--disable-ffplay \
--enable-filter=copy \
--enable-protocol=file \
--enable-small && \
PATH="$HOME/bin:$PATH" make -j$(nproc) && \
make install && \
hash -r
FROM swaggerapi/swagger-ui:v5.9.1 AS swagger-ui FROM swaggerapi/swagger-ui:v5.9.1 AS swagger-ui
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04
ENV PYTHON_VERSION=3.10 ENV PYTHON_VERSION=3.10
...@@ -10,7 +51,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \ ...@@ -10,7 +51,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
python${PYTHON_VERSION} \ python${PYTHON_VERSION} \
python${PYTHON_VERSION}-venv \ python${PYTHON_VERSION}-venv \
python3-pip \ python3-pip \
ffmpeg \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \ RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
...@@ -31,6 +71,8 @@ RUN poetry config virtualenvs.in-project true ...@@ -31,6 +71,8 @@ RUN poetry config virtualenvs.in-project true
RUN poetry install --no-root RUN poetry install --no-root
COPY . . COPY . .
COPY --from=ffmpeg /FFmpeg-6.1.1 /FFmpeg-6.1.1
COPY --from=ffmpeg /root/bin/ffmpeg /usr/local/bin/ffmpeg
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui.css swagger-ui-assets/swagger-ui.css
COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js COPY --from=swagger-ui /usr/share/nginx/html/swagger-ui-bundle.js swagger-ui-assets/swagger-ui-bundle.js
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment