Created
January 28, 2023 02:58
-
-
Save Dishwasha/8d43e375719b7c4ed155b6795f6cae2b to your computer and use it in GitHub Desktop.
gstreamer 1.22 upgrade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# STAGE 1: SERVER | |
# | |
FROM buildpack-deps:bookworm as gstreamer | |
WORKDIR /src | |
RUN set -eux; \ | |
echo "deb-src http://deb.debian.org/debian bookworm main" >> /etc/apt/sources.list; \ | |
apt-get update; \ | |
apt-get install -y git build-essential fakeroot devscripts libxi-dev | |
RUN set -eux; \ | |
debcheckout gir1.2-gstreamer-1.0; \ | |
apt -y build-dep gir1.2-gstreamer-1.0; \ | |
cd gir1.2-gstreamer-1.0; \ | |
origtargz; \ | |
debuild -b -uc -us; \ | |
cd ..; \ | |
dpkg -i ./gir1.2-gstreamer-1.0_1.22.0-1_amd64.deb ./gstreamer1.0-tools_1.22.0-1_amd64.deb ./libgstreamer1.0-0_1.22.0-1_amd64.deb ./libgstreamer1.0-dev_1.22.0-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout libgstreamer-plugins-base1.0-dev; \ | |
apt -y build-dep libgstreamer-plugins-base1.0-dev; \ | |
cd libgstreamer-plugins-base1.0-dev; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i ./libgstreamer-gl1.0-0_1.22.0-1_amd64.deb ./gir1.2-gst-plugins-base-1.0_1.22.0-1_amd64.deb ./libgstreamer-plugins-base1.0-0_1.22.0-1_amd64.deb ./libgstreamer-plugins-base1.0-dev_1.22.0-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout gstreamer1.0-plugins-base; \ | |
apt -y build-dep gstreamer1.0-plugins-base; \ | |
cd gstreamer1.0-plugins-base; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i ./gstreamer1.0-plugins-base_1.22.0-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout gstreamer1.0-plugins-bad; \ | |
apt -y build-dep gstreamer1.0-plugins-bad; \ | |
cd gstreamer1.0-plugins-bad; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i ./libgstreamer-plugins-bad1.0-0_1.20.5-1_amd64.deb ./gstreamer1.0-plugins-bad_1.20.5-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout gstreamer1.0-plugins-ugly; \ | |
apt -y build-dep gstreamer1.0-plugins-ugly; \ | |
cd gstreamer1.0-plugins-ugly; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i ./gstreamer1.0-plugins-ugly_1.20.5-1_amd64.deb; | |
RUN set -eux; \ | |
apt -y install libxml2-dev qt6-base-dev qt6-declarative-dev qt6-tools-dev libsoup2.4-1; \ | |
debcheckout gstreamer1.0-plugins-good; \ | |
apt -y build-dep gstreamer1.0-plugins-good; \ | |
cd gstreamer1.0-plugins-good; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i --force-all ./gstreamer1.0-plugins-good_1.22.0-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout gstreamer1.0-pulseaudio; \ | |
apt -y build-dep gstreamer1.0-pulseaudio; \ | |
cd gstreamer1.0-pulseaudio; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i --force-all ./gstreamer1.0-pulseaudio_1.22.0-1_amd64.deb; | |
RUN set -eux; \ | |
debcheckout gstreamer1.0-vaapi; \ | |
apt -y build-dep gstreamer1.0-vaapi; \ | |
cd gstreamer1.0-vaapi; \ | |
origtargz; \ | |
DEB_BUILD_OPTIONS=nocheck debuild -b -uc -us; \ | |
cd ..; \ | |
ls; \ | |
dpkg -i --force-all ./gstreamer1.0-vaapi_1.20.5-1_amd64.deb; | |
FROM gstreamer as rav1enc | |
ENV RUSTUP_HOME=/usr/local/rustup \ | |
CARGO_HOME=/usr/local/cargo \ | |
PATH=/usr/local/cargo/bin:$PATH \ | |
RUST_VERSION=1.66.1 | |
RUN set -eux; \ | |
dpkgArch="$(dpkg --print-architecture)"; \ | |
case "${dpkgArch##*-}" in \ | |
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='5cc9ffd1026e82e7fb2eec2121ad71f4b0f044e88bca39207b3f6b769aaa799c' ;; \ | |
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='48c5ecfd1409da93164af20cf4ac2c6f00688b15eb6ba65047f654060c844d85' ;; \ | |
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e189948e396d47254103a49c987e7fb0e5dd8e34b200aa4481ecc4b8e41fb929' ;; \ | |
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='0e0be29c560ad958ba52fcf06b3ea04435cb3cd674fbe11ce7d954093b9504fd' ;; \ | |
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ | |
esac; \ | |
url="https://static.rust-lang.org/rustup/archive/1.25.1/${rustArch}/rustup-init"; \ | |
wget "$url"; \ | |
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ | |
chmod +x rustup-init; \ | |
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ | |
rm rustup-init; \ | |
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ | |
rustup --version; \ | |
cargo --version; \ | |
rustc --version; | |
WORKDIR /src | |
COPY .docker/base/0002-Fix-MIME-type.patch . | |
RUN set -eux; \ | |
cd /tmp; \ | |
git clone --depth=1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git; \ | |
cd gst-plugins-rs; \ | |
git apply /src/0002-Fix-MIME-type.patch; \ | |
cargo build -r -p gst-plugin-rav1e; | |
FROM buildpack-deps:bookworm as server | |
# install cgo-related dependencies | |
RUN set -eux; \ | |
apt-get update; \ | |
apt-get install -y --no-install-recommends \ | |
g++ \ | |
gcc \ | |
libc6-dev \ | |
make \ | |
pkg-config \ | |
; \ | |
rm -rf /var/lib/apt/lists/* | |
ENV PATH /usr/local/go/bin:$PATH | |
ENV GOLANG_VERSION 1.18.10 | |
RUN set -eux; \ | |
arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; \ | |
url=; \ | |
case "$arch" in \ | |
'amd64') \ | |
url='https://dl.google.com/go/go1.18.10.linux-amd64.tar.gz'; \ | |
sha256='5e05400e4c79ef5394424c0eff5b9141cb782da25f64f79d54c98af0a37f8d49'; \ | |
;; \ | |
'armel') \ | |
export GOARCH='arm' GOARM='5' GOOS='linux'; \ | |
;; \ | |
'armhf') \ | |
url='https://dl.google.com/go/go1.18.10.linux-armv6l.tar.gz'; \ | |
sha256='e9f2f2361364c04a8f0d12228e4c5c2b870f4d1639ca92031c4013a95aa205be'; \ | |
;; \ | |
'arm64') \ | |
url='https://dl.google.com/go/go1.18.10.linux-arm64.tar.gz'; \ | |
sha256='160497c583d4c7cbc1661230e68b758d01f741cf4bece67e48edc4fdd40ed92d'; \ | |
;; \ | |
'i386') \ | |
url='https://dl.google.com/go/go1.18.10.linux-386.tar.gz'; \ | |
sha256='9249551992c9518ec8ce6690d32206f12ed9122e360407f7e7ab9a6adc627a9b'; \ | |
;; \ | |
'mips64el') \ | |
export GOARCH='mips64le' GOOS='linux'; \ | |
;; \ | |
'ppc64el') \ | |
url='https://dl.google.com/go/go1.18.10.linux-ppc64le.tar.gz'; \ | |
sha256='761014290febf0e10dfeba44ec551792dad32270a11debee8ed4f30c5f3c760d'; \ | |
;; \ | |
's390x') \ | |
url='https://dl.google.com/go/go1.18.10.linux-s390x.tar.gz'; \ | |
sha256='9755ab0460a04b535e513fac84db2e1ae6a197d66d3a097e14aed3b3114df85d'; \ | |
;; \ | |
*) echo >&2 "error: unsupported architecture '$arch' (likely packaging update needed)"; exit 1 ;; \ | |
esac; \ | |
build=; \ | |
if [ -z "$url" ]; then \ | |
# https://github.com/golang/go/issues/38536#issuecomment-616897960 | |
build=1; \ | |
url='https://dl.google.com/go/go1.18.10.src.tar.gz'; \ | |
sha256='9cedcca58845df0c9474ae00274c44a95c9dfaefb132fc59921c28c7c106f8e6'; \ | |
echo >&2; \ | |
echo >&2 "warning: current architecture ($arch) does not have a compatible Go binary release; will be building from source"; \ | |
echo >&2; \ | |
fi; \ | |
\ | |
wget -O go.tgz.asc "$url.asc"; \ | |
wget -O go.tgz "$url" --progress=dot:giga; \ | |
echo "$sha256 *go.tgz" | sha256sum -c -; \ | |
\ | |
# https://github.com/golang/go/issues/14739#issuecomment-324767697 | |
GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; \ | |
# https://www.google.com/linuxrepositories/ | |
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys 'EB4C 1BFD 4F04 2F6D DDCC EC91 7721 F63B D38B 4796'; \ | |
# let's also fetch the specific subkey of that key explicitly that we expect "go.tgz.asc" to be signed by, just to make sure we definitely have it | |
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '2F52 8D36 D67B 69ED F998 D857 78BD 6547 3CB3 BD13'; \ | |
gpg --batch --verify go.tgz.asc go.tgz; \ | |
gpgconf --kill all; \ | |
rm -rf "$GNUPGHOME" go.tgz.asc; \ | |
\ | |
tar -C /usr/local -xzf go.tgz; \ | |
rm go.tgz; \ | |
\ | |
if [ -n "$build" ]; then \ | |
savedAptMark="$(apt-mark showmanual)"; \ | |
apt-get update; \ | |
apt-get install -y --no-install-recommends golang-go; \ | |
\ | |
export GOCACHE='/tmp/gocache'; \ | |
\ | |
( \ | |
cd /usr/local/go/src; \ | |
# set GOROOT_BOOTSTRAP + GOHOST* such that we can build Go successfully | |
export GOROOT_BOOTSTRAP="$(go env GOROOT)" GOHOSTOS="$GOOS" GOHOSTARCH="$GOARCH"; \ | |
./make.bash; \ | |
); \ | |
\ | |
apt-mark auto '.*' > /dev/null; \ | |
apt-mark manual $savedAptMark > /dev/null; \ | |
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ | |
rm -rf /var/lib/apt/lists/*; \ | |
\ | |
# remove a few intermediate / bootstrapping files the official binary release tarballs do not contain | |
rm -rf \ | |
/usr/local/go/pkg/*/cmd \ | |
/usr/local/go/pkg/bootstrap \ | |
/usr/local/go/pkg/obj \ | |
/usr/local/go/pkg/tool/*/api \ | |
/usr/local/go/pkg/tool/*/go_bootstrap \ | |
/usr/local/go/src/cmd/dist/dist \ | |
"$GOCACHE" \ | |
; \ | |
fi; \ | |
\ | |
go version | |
ENV GOPATH /go | |
ENV PATH $GOPATH/bin:$PATH | |
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" | |
#FROM golang:1.18-bullseye as server | |
WORKDIR /src | |
COPY .docker/base/0001-Fix-MIME-type.patch . | |
# COPY .docker/base/bookworm.list /etc/apt/sources.list | |
COPY --from=gstreamer /src/*.deb /src/ | |
# | |
# install dependencies | |
RUN set -eux; apt update; apt-get install -y git cmake make libx11-dev libxrandr-dev \ | |
libxtst-dev python3-pip pkg-config yasm libsoup2.4-1 libdw1 libunwind8 libcap2-bin libdrm2 libegl1 libgbm1 \ | |
libgl1 libgudev-1.0-0 libwayland-client0 libwayland-egl1 libx11-xcb1 libunwind-dev libdw-dev libwayland-cursor0 liborc-0.4-0 iso-codes \ | |
liborc-0.4-dev libgl-dev libegl-dev libgles-dev libx11-xcb-dev libwayland-dev libdrm-dev libgbm-dev libgudev-1.0-dev libva-drm2 libva2 \ | |
libass9 libbs2b0 libdc1394-25 libdca0 libdvdnav4 libdvdread8 libfaad2 libflite1 libfluidsynth3 libfreeaptx0 libgme0 \ | |
libgsm1 libgstreamer-gl1.0-0 libjson-glib-1.0-0 libkate1 libldacbt-enc2 liblilv-0-0 libltc11 libmfx1 libmjpegutils-2.1-0 libmodplug1 \ | |
libmpcdec6 libmpeg2encpp-2.1-0 libmplex2-2.1-0 libnice10 libopenal1 libopenh264-7 libopenmpt0 libopenni2-0 libopus0 liborc-0.4-0 libqrencode4 \ | |
libsbc1 libsndfile1 libsoundtouch1 libspandsp2 libsrt1.5-gnutls libsrtp2-1 libusb-1.0-0 libva-drm2 libva2 libvo-aacenc0 libvo-amrwbenc0 \ | |
libwebrtc-audio-processing1 libwildmidi2 libzbar0 libzvbi0 libzxing2 liba52-0.7.4 libcdio19 libmpeg2-4 libopencore-amrnb0 libopencore-amrwb0 \ | |
libsidplay1v5 libx264-164 libchromaprint1 libaa1 libavc1394-0 libcaca0 libdv4 libiec61883-0 libshout3 libtag1v5 libwavpack1 libxdamage1 libva-wayland2; | |
RUN set -eux; dpkg -i --force-all ./libgstreamer1.0-0_1.22.0-1_amd64.deb ./gir1.2-gstreamer-1.0_1.22.0-1_amd64.deb ./gstreamer1.0-tools_1.22.0-1_amd64.deb \ | |
./libgstreamer1.0-dev_1.22.0-1_amd64.deb ./libgstreamer-gl1.0-0_1.22.0-1_amd64.deb ./gir1.2-gst-plugins-base-1.0_1.22.0-1_amd64.deb ./gstreamer1.0-plugins-base_1.22.0-1_amd64.deb \ | |
./libgstreamer-plugins-base1.0-0_1.22.0-1_amd64.deb ./libgstreamer-plugins-base1.0-dev_1.22.0-1_amd64.deb ./gstreamer1.0-plugins-good_1.22.0-1_amd64.deb \ | |
./gstreamer1.0-plugins-ugly_1.20.5-1_amd64.deb ./libgstreamer-plugins-bad1.0-0_1.20.5-1_amd64.deb ./gstreamer1.0-plugins-bad_1.20.5-1_amd64.deb \ | |
./gstreamer1.0-vaapi_1.20.5-1_amd64.deb; | |
RUN set -eux; dpkg -i --force-all ./gstreamer1.0-plugins-good_1.22.0-1_amd64.deb; | |
# gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly; \ | |
# | |
# install libclipboard | |
RUN set -eux; \ | |
cd /tmp; \ | |
git clone --depth=1 https://github.com/jtanx/libclipboard; \ | |
cd libclipboard; \ | |
cmake .; \ | |
make -j4; \ | |
make install; \ | |
cd /tmp; \ | |
rm -rf /tmp/libclipboard; \ | |
# | |
# install libgstsvtav1enc.so | |
# pip3 install meson ninja; \ | |
# git clone --depth=1 --branch v1.4.1 https://gitlab.com/AOMediaCodec/SVT-AV1.git; \ | |
# git config --global user.email "you@example.com"; \ | |
# git config --global user.name "Your Name"; \ | |
# git -C SVT-AV1 am /src/0001-Fix-MIME-type.patch; \ | |
# SVT-AV1/Build/linux/build.sh debug; \ | |
# cp /tmp/SVT-AV1/Source/API/Eb*.h /usr/local/include; \ | |
# cmake -P SVT-AV1/Build/linux/Debug/Source/Lib/Encoder/cmake_install.cmake; \ | |
# cd SVT-AV1/gstreamer-plugin; \ | |
# meson -Dprefix=/usr build; \ | |
# ninja -C build install; \ | |
# | |
# clean up | |
apt-get clean -y; \ | |
rm -rf /var/lib/apt/lists/* /var/cache/apt/* | |
# | |
# build server | |
COPY server/ . | |
RUN go get -v -t -d . && go build -o bin/neko cmd/neko/main.go | |
# | |
# STAGE 2: CLIENT | |
# | |
FROM node:14-bullseye-slim as client | |
WORKDIR /src | |
# | |
# install dependencies | |
COPY client/package*.json ./ | |
RUN npm install | |
# | |
# build client | |
COPY client/ . | |
RUN npm run build | |
# | |
# STAGE 3: RUNTIME | |
# | |
FROM debian:bookworm | |
# | |
# avoid warnings by switching to noninteractive | |
ENV DEBIAN_FRONTEND=noninteractive | |
# | |
# set custom user | |
ARG USERNAME=neko | |
ARG USER_UID=1000 | |
ARG USER_GID=$USER_UID | |
COPY --from=gstreamer /src/*.deb /src/ | |
RUN set -eux; \ | |
apt-get update; \ | |
# | |
# install dependencies | |
apt-get install -y --no-install-recommends wget ca-certificates supervisor; \ | |
apt-get install -y --no-install-recommends pulseaudio dbus-x11 xserver-xorg-video-dummy; \ | |
apt-get install -y --no-install-recommends libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libsoup2.4-1; | |
# | |
# gst | |
RUN set -eux; apt-get install -y python3-pip pkg-config yasm libsoup2.4-1 libdw1 libunwind8 libcap2-bin libdrm2 libegl1 libgbm1 \ | |
libgl1 libgudev-1.0-0 libwayland-client0 libwayland-egl1 libx11-xcb1 libwayland-cursor0 liborc-0.4-0 iso-codes libgles2 \ | |
libva-drm2 libva2 gir1.2-glib-2.0 libcdparanoia0 libvisual-0.4-0 libcurl3-gnutls librtmp1 \ | |
libass9 libbs2b0 libdc1394-25 libdca0 libdvdnav4 libdvdread8 libfaad2 libflite1 libfluidsynth3 libfreeaptx0 libgme0 \ | |
libgsm1 libgstreamer-gl1.0-0 libjson-glib-1.0-0 libkate1 libldacbt-enc2 liblilv-0-0 libltc11 libmfx1 libmjpegutils-2.1-0 libmodplug1 \ | |
libmpcdec6 libmpeg2encpp-2.1-0 libmplex2-2.1-0 libnice10 libopenal1 libopenh264-7 libopenmpt0 libopenni2-0 libopus0 liborc-0.4-0 libqrencode4 \ | |
libsbc1 libsndfile1 libsoundtouch1 libspandsp2 libsrt1.5-gnutls libsrtp2-1 libusb-1.0-0 libva-drm2 libva2 libvo-aacenc0 libvo-amrwbenc0 \ | |
libwebrtc-audio-processing1 libwildmidi2 libzbar0 libzvbi0 libzxing2 liba52-0.7.4 libcdio19 libmpeg2-4 libopencore-amrnb0 libopencore-amrwb0 \ | |
libsidplay1v5 libx264-164 libchromaprint1 libaa1 libavc1394-0 libcaca0 libdv4 libiec61883-0 libshout3 libtag1v5 libwavpack1 libxdamage1 libva-wayland2; | |
RUN set -eux; dpkg -i --force-all /src/libgstreamer1.0-0_1.22.0-1_amd64.deb /src/gir1.2-gstreamer-1.0_1.22.0-1_amd64.deb /src/gstreamer1.0-tools_1.22.0-1_amd64.deb \ | |
/src/libgstreamer-gl1.0-0_1.22.0-1_amd64.deb /src/gir1.2-gst-plugins-base-1.0_1.22.0-1_amd64.deb /src/gstreamer1.0-plugins-base_1.22.0-1_amd64.deb \ | |
/src/libgstreamer-plugins-base1.0-0_1.22.0-1_amd64.deb /src/gstreamer1.0-plugins-good_1.22.0-1_amd64.deb \ | |
/src/gstreamer1.0-plugins-ugly_1.20.5-1_amd64.deb /src/libgstreamer-plugins-bad1.0-0_1.20.5-1_amd64.deb /src/gstreamer1.0-plugins-bad_1.20.5-1_amd64.deb \ | |
/src/gstreamer1.0-vaapi_1.20.5-1_amd64.deb; | |
RUN set -eux; dpkg -i --force-all /src/gstreamer1.0-plugins-good_1.22.0-1_amd64.deb; | |
# apt-get install -y --no-install-recommends libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ | |
# gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio \ | |
# gstreamer1.0-vaapi gstreamer1.0-tools;\ | |
# dpkg -i --force-all ./gir1.2-gstreamer-1.0_1.22.0-1_amd64.deb; \ | |
# ./gstreamer1.0-tools_1.22.0-1_amd64.deb ./libgstreamer1.0-0_1.22.0-1_amd64.deb \ | |
# ./libgstreamer1.0-dev_1.22.0-1_amd64.deb ./libgstreamer-gl1.0-0_1.22.0-1_amd64.deb ./gir1.2-gst-plugins-base-1.0_1.22.0-1_amd64.deb \ | |
# ./libgstreamer-plugins-base1.0-0_1.22.0-1_amd64.deb ./libgstreamer-plugins-base1.0-dev_1.22.0-1_amd64.deb \ | |
# ./gstreamer1.0-plugins-good_1.22.0-1_amd64.deb ./gstreamer1.0-plugins-ugly_1.20.5-1_amd64.deb gstreamer1.0-pulseaudio_1.22.0-1_amd64.deb gstreamer1.0-vaapi_1.22.0-1_amd64.deb; \ | |
# | |
# install fonts | |
RUN set -eux; apt-get install -y --no-install-recommends \ | |
# Google emojis | |
fonts-noto-color-emoji \ | |
# Japanese fonts | |
fonts-takao-mincho \ | |
# Chinese fonts | |
fonts-wqy-zenhei; \ | |
# | |
# create a non-root user | |
groupadd --gid $USER_GID $USERNAME; \ | |
useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \ | |
adduser $USERNAME audio; \ | |
adduser $USERNAME video; \ | |
adduser $USERNAME pulse; \ | |
# | |
# setup pulseaudio | |
mkdir -p /home/$USERNAME/.config/pulse/; \ | |
echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf; \ | |
# | |
# workaround for an X11 problem: http://blog.tigerteufel.de/?p=476 | |
mkdir /tmp/.X11-unix; \ | |
chmod 1777 /tmp/.X11-unix; \ | |
chown $USERNAME /tmp/.X11-unix/; \ | |
# | |
# make directories for neko | |
mkdir -p /etc/neko /var/www /var/log/neko; \ | |
chmod 1777 /var/log/neko; \ | |
chown $USERNAME /var/log/neko/; \ | |
chown -R $USERNAME:$USERNAME /home/$USERNAME; \ | |
# | |
# clean up | |
apt-get clean -y; \ | |
rm -rf /var/lib/apt/lists/* /var/cache/apt/* | |
# | |
# copy config files | |
COPY .docker/base/dbus /usr/bin/dbus | |
COPY .docker/base/default.pa /etc/pulse/default.pa | |
COPY .docker/base/supervisord.conf /etc/neko/supervisord.conf | |
COPY .docker/base/xorg.conf /etc/neko/xorg.conf | |
# | |
# set default envs | |
ENV USER=$USERNAME | |
ENV DISPLAY=:99.0 | |
ENV NEKO_PASSWORD=neko | |
ENV NEKO_PASSWORD_ADMIN=admin | |
ENV NEKO_BIND=:8080 | |
# | |
# copy static files from previous stages | |
COPY --from=server /src/bin/neko /usr/bin/neko | |
# COPY --from=server /usr/local/lib/libSvtAv1Enc.so.1.4.1 /usr/lib/x86_64-linux-gnu/libSvtAv1Enc.so.1.4.1 | |
# COPY --from=server /usr/local/lib/libSvtAv1Enc.so.1 /usr/lib/x86_64-linux-gnu/libSvtAv1Enc.so.1 | |
# COPY --from=server /usr/lib/gstreamer-1.0/libgstsvtav1enc.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstsvtav1enc.so | |
COPY --from=rav1enc /tmp/gst-plugins-rs/target/release/libgstrav1e.so /usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstrav1e.so | |
COPY --from=client /src/dist/ /var/www | |
HEALTHCHECK --interval=10s --timeout=5s --retries=8 \ | |
CMD wget -O - http://localhost:${NEKO_BIND#*:}/health || exit 1 | |
# | |
# run neko | |
CMD ["/usr/bin/supervisord", "-c", "/etc/neko/supervisord.conf"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment