diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..94143827 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..bb3e4fc2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:bullseye AS builder +WORKDIR /app +COPY . . +RUN CGO_ENABLED=0 go build -buildvcs=false -ldflags="-s -w" + +FROM ubuntu:22.04 +WORKDIR /app +ENV DEBIAN_FRONTEND=noninteractive +COPY ./build-ffmpeg.sh . +RUN ./build-ffmpeg.sh + +COPY --from=builder /app/go-vod . +EXPOSE 47788 +CMD ["/app/go-vod", "config.json"] diff --git a/build-ffmpeg.sh b/build-ffmpeg.sh new file mode 100755 index 00000000..fe642dd8 --- /dev/null +++ b/build-ffmpeg.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +apt-get update +apt-get remove -y libva ffmpeg +apt-get install -y \ + sudo curl wget \ + autoconf libtool libdrm-dev xorg xorg-dev openbox \ + libx11-dev libgl1-mesa-glx libgl1-mesa-dev \ + xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev \ + libxkbcommon-x11-dev libxcb-dri3-dev \ + cmake git nasm build-essential + +mkdir qsvbuild +cd qsvbuild + +git clone --depth 1 --branch 2.17.0 https://github.com/intel/libva +cd libva +./autogen.sh +make +sudo make install +sudo ldconfig +cd .. + +git clone --depth 1 --branch intel-gmmlib-22.3.4 https://github.com/intel/gmmlib +cd gmmlib +mkdir build && cd build +cmake .. +make -j"$(nproc)" +sudo make install +sudo ldconfig +cd ../.. + +git clone --depth 1 --branch intel-media-22.6.6 https://github.com/intel/media-driver +mkdir -p build_media +cd build_media +cmake ../media-driver +make -j"$(nproc)" +sudo make install +sudo ldconfig +cd .. + +git clone --depth 1 --branch n6.0 https://github.com/FFmpeg/FFmpeg +cd FFmpeg +./configure --enable-nonfree +make -j"$(nproc)" +sudo make install +sudo ldconfig +cd .. + +cd .. +rm -rf qsvbuild + +rm -rf /var/lib/apt/lists/*