mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
86 lines
2.3 KiB
Bash
Executable File
86 lines
2.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --cap-add SYS_ADMIN nurdism/neko:chromium
|
|
# sudo docker run -p 80:8080 -p 59000-59100:59000-59100/udp --shm-size=1gb nurdism/neko:firefox
|
|
# sudo docker run --network host --shm-size=1gb -it nurdism/neko:base /bin/bash
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.."
|
|
|
|
build_gst() {
|
|
if [ ! -d /gst ]; then
|
|
sudo mkdir -p /workspace/.build/gst
|
|
sudo ln -s /workspace/.build/gst /gst
|
|
sudo chown -R neko /workspace/.build
|
|
fi
|
|
|
|
#
|
|
# build & install gstreamer
|
|
sudo su -c 'set -eux; \
|
|
rm -rf /gst/local; \
|
|
cd /gst; \
|
|
for MODULE in \
|
|
gstreamer \
|
|
gst-plugins-base \
|
|
gst-plugins-good \
|
|
; do \
|
|
if [ ! -d $MODULE ]; then
|
|
git clone git://anongit.freedesktop.org/gstreamer/$MODULE; \
|
|
fi
|
|
cd $MODULE; \
|
|
git checkout 1.16; \
|
|
case $MODULE in \
|
|
gstreamer) GST_ARGS="--disable-gtk-doc" ;; \
|
|
gst-plugins-base) GST_ARGS="--disable-gtk-doc --disable-x --disable-xvideo" ;; \
|
|
gst-plugins-good) GST_ARGS="--disable-gtk-doc --disable-oss --disable-oss4 --disable-gst_v4l2" ;; \
|
|
esac; \
|
|
PATH=/gst/local/bin:$PATH PKG_CONFIG_PATH=/gst/local/lib/pkgconfig ./autogen.sh --prefix /gst/local $GST_ARGS; \
|
|
make; make install; \
|
|
cd /gst; \
|
|
done'
|
|
}
|
|
|
|
build_base() {
|
|
set -eux; \
|
|
cd $DIR/server; go get; ./build; \
|
|
cd $DIR/client; npm install; npm run build; \
|
|
cd $DIR; sudo docker build -f Dockerfile -t nurdism/neko:base . ;
|
|
}
|
|
|
|
build_firefox() {
|
|
set -eux; \
|
|
cd $DIR/.docker/files/firefox; \
|
|
sudo docker build -f Dockerfile -t nurdism/neko:firefox -t nurdism/neko:latest . ;
|
|
}
|
|
|
|
build_chromium() {
|
|
set -eux; \
|
|
cd $DIR/.docker/files/chromium; \
|
|
sudo docker build -f Dockerfile -t nurdism/neko:chromium -t nurdism/neko:latest . ;
|
|
}
|
|
|
|
build_docker() {
|
|
if [ ! -d /gst/local ]; then
|
|
build_gst
|
|
fi
|
|
|
|
set -eux; \
|
|
build_base; \
|
|
build_firefox; \
|
|
build_chromium; \
|
|
sudo docker images nurdism/neko
|
|
}
|
|
|
|
build_push() {
|
|
sudo docker push nurdism/neko:base
|
|
sudo docker push nurdism/neko:latest
|
|
sudo docker push nurdism/neko:firefox
|
|
sudo docker push nurdism/neko:chromium
|
|
}
|
|
|
|
case $1 in
|
|
push) build_push ;;
|
|
docker) build_docker ;;
|
|
gst) build_gst ;;
|
|
*) build_docker ;;
|
|
esac
|