This commit is contained in:
Craig 2020-01-27 01:28:39 +00:00
parent 06feef7559
commit 0e9fbf7ba2
17 changed files with 335 additions and 237 deletions

View File

@ -1,129 +1,157 @@
FROM golang:stretch FROM nurdism/neko
# This Dockerfile adds a non-root user with sudo access. Use the "remoteUser" ARG USERNAME=neko
# property in devcontainer.json to use it. On Linux, the container user's GID/UIDs
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000 ARG USER_UID=1000
ARG USER_GID=$USER_UID ARG USER_GID=$USER_UID
# Avoid warnings by switching to noninteractive # Set to false to skip installing zsh and Oh My ZSH!
ENV DEBIAN_FRONTEND=noninteractive ARG INSTALL_ZSH="true"
# Runtime for testing and compileing # Location and expected SHA for common setup script - SHA generated on release
RUN apt-get update \ ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-alpine.sh"
&& apt-get -y install supervisor openbox dbus-x11 ttf-freefont xvfb pulseaudio consolekit firefox-esr x11vnc \ ARG COMMON_SCRIPT_SHA="dev-mode"
&& apt-get -y install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-good gstreamer1.0-pulseaudio \
&& apt-get -y install gcc libc6-dev \
&& apt-get -y install libx11-dev xorg-dev libxtst-dev libpng++-dev \
&& apt-get -y install xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev libxkbcommon-x11-dev \
&& apt-get -y install libxkbcommon-dev \
&& apt-get -y install xsel xclip
# Configure apt, install packages and tools # Install git, bash, dependencies, and add a non-root user
RUN apt-get update \ RUN apk update \
&& apt-get -y install --no-install-recommends apt-utils apt-transport-https dialog 2>&1 \ && apk add --no-cache wget coreutils ca-certificates \
# && apk add --no-cache wget openssl docker libxtst-dev xclip x11vnc glib-dev gobject-introspection \
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed #
&& apt-get -y install git iproute2 procps lsb-release xz-utils \ # Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
# && wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE \
# Install Docker CE CLI && if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi \
&& apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common lsb-release \ && /bin/ash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID" \
&& curl -fsSL https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]')/gpg | (OUT=$(apt-key add - 2>&1) || echo $OUT) \ && rm /tmp/common-setup.sh
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(lsb_release -is | tr '[:upper:]' '[:lower:]') $(lsb_release -cs) stable" \
&& apt-get update \
&& apt-get install -y docker-ce-cli \
#
# Install Docker Compose
&& curl -sSL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/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 \
# Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
ENV NODE_VERSION 12.14.1 ENV NODE_VERSION 13.7.0
RUN apk add --no-cache curl libstdc++ \
&& ARCH= && alpineArch="$(apk --print-arch)" \
&& case "${alpineArch##*-}" in \
x86_64) \
ARCH='x64' \
CHECKSUM="4c153345a08d2eeb40dfbb62f1ef6ade7ec369630f9cf9f061bf9d52b10acafc" \
;; \
*) ;; \
esac \
&& if [ -n "${CHECKSUM}" ]; then \
set -eu; \
curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \
echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs; \
else \
echo "Building from source" \
# backup build
&& apk add --no-cache binutils-gold g++ gcc gnupg libgcc linux-headers make python \
# gpg keys listed at https://github.com/nodejs/node#release-keys
&& for key in \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
FD3A5288F042B6850C66B31F09FE44734EB7990E \
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
77984A986EBC2AA786BC0F66B01FBB92821C587A \
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
4ED778F539E3634C779C87C6D7062848A1AB005C \
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
; do \
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
done \
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
&& tar -xf "node-v$NODE_VERSION.tar.xz" \
&& cd "node-v$NODE_VERSION" \
&& ./configure \
&& make -j$(getconf _NPROCESSORS_ONLN) V= \
&& make install \
&& cd .. \
&& rm -Rf "node-v$NODE_VERSION" \
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
fi \
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ ENV GOLANG_VERSION 1.13.6
&& case "${dpkgArch##*-}" in \ RUN set -eux \
amd64) ARCH='x64';; \ && apk add --no-cache bash gcc musl-dev openssl go \
ppc64el) ARCH='ppc64le';; \ && export \
s390x) ARCH='s390x';; \ # set GOROOT_BOOTSTRAP such that we can actually build Go
arm64) ARCH='arm64';; \ GOROOT_BOOTSTRAP="$(go env GOROOT)" \
armhf) ARCH='armv7l';; \ # ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
i386) ARCH='x86';; \ # (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
*) echo "unsupported architecture"; exit 1 ;; \ GOOS="$(go env GOOS)" \
esac \ GOARCH="$(go env GOARCH)" \
# gpg keys listed at https://github.com/nodejs/node#release-keys GOHOSTOS="$(go env GOHOSTOS)" \
&& set -ex \ GOHOSTARCH="$(go env GOHOSTARCH)" \
&& for key in \ ; \
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ # also explicitly set GO386 and GOARM if appropriate
FD3A5288F042B6850C66B31F09FE44734EB7990E \ # https://github.com/docker-library/golang/issues/184
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ apkArch="$(apk --print-arch)"; \
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ case "$apkArch" in \
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ armhf) export GOARM='6' ;; \
B9AE9905FFD7803F25714661B63B535A4C206CA9 \ armv7) export GOARM='7' ;; \
77984A986EBC2AA786BC0F66B01FBB92821C587A \ x86) export GO386='387' ;; \
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ esac; \
4ED778F539E3634C779C87C6D7062848A1AB005C \ wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ echo 'aae5be954bdc40bcf8006eb77e8d8a5dde412722bc8effcdaf9772620d06420c *go.tgz' | sha256sum -c -; \
B9E2F5981AA6E0CD28160D9FF13993A75599653C \ tar -C /usr/local -xzf go.tgz; \
; do \ rm go.tgz; \
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ cd /usr/local/go/src; \
gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ ./make.bash; \
gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ rm -rf \
done \ # https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \ /usr/local/go/pkg/bootstrap \
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ # https://golang.org/cl/82095
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ # https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
&& grep " node-v$NODE_VERSION-linux-$ARCH.tar.xz\$" SHASUMS256.txt | sha256sum -c - \ /usr/local/go/pkg/obj \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \ && export PATH="/usr/local/go/bin:$PATH" \
&& rm "node-v$NODE_VERSION-linux-$ARCH.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt \ && go version
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
USER $USERNAME ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
# Install packages and tools #
RUN go get -x -d github.com/stamblerre/gocode 2>&1 \ # Install Go tools w/module support
RUN mkdir -p /tmp/gotools \
&& cd /tmp/gotools \
&& GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \
&& GO111MODULE=on go get -v \
honnef.co/go/tools/...@latest \
golang.org/x/tools/cmd/gorename@latest \
golang.org/x/tools/cmd/goimports@latest \
golang.org/x/tools/cmd/guru@latest \
golang.org/x/lint/golint@latest \
github.com/mdempsky/gocode@latest \
github.com/cweill/gotests/...@latest \
github.com/haya14busa/goplay/cmd/goplay@latest \
github.com/sqs/goreturns@latest \
github.com/josharian/impl@latest \
github.com/davidrjenni/reftools/cmd/fillstruct@latest \
github.com/uudashr/gopkgs/cmd/gopkgs@latest \
github.com/ramya-rao-a/go-outline@latest \
github.com/acroca/go-symbols@latest \
github.com/godoctor/godoctor@latest \
github.com/rogpeppe/godef@latest \
github.com/zmb3/gogetdoc@latest \
github.com/fatih/gomodifytags@latest \
github.com/mgechev/revive@latest \
github.com/go-delve/delve/cmd/dlv@latest 2>&1 \
#
# Install Go tools w/o module support
&& go get -v github.com/alecthomas/gometalinter 2>&1 \
#
# Install gocode-gomod
&& go get -x -d github.com/stamblerre/gocode 2>&1 \
&& go build -o gocode-gomod github.com/stamblerre/gocode \ && go build -o gocode-gomod github.com/stamblerre/gocode \
&& mv gocode-gomod $GOPATH/bin/ \ && mv gocode-gomod $GOPATH/bin/ \
# #
# Install Go tools # Install golangci-lint
&& go get -u -v \ && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1
github.com/mdempsky/gocode \
github.com/uudashr/gopkgs/cmd/gopkgs \ RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod" && chmod -R 777 "$GOPATH"
github.com/ramya-rao-a/go-outline \
github.com/acroca/go-symbols \
github.com/godoctor/godoctor \
golang.org/x/tools/cmd/guru \
golang.org/x/tools/cmd/gorename \
github.com/rogpeppe/godef \
github.com/zmb3/gogetdoc \
github.com/haya14busa/goplay/cmd/goplay \
github.com/sqs/goreturns \
github.com/josharian/impl \
github.com/davidrjenni/reftools/cmd/fillstruct \
github.com/fatih/gomodifytags \
github.com/cweill/gotests/... \
golang.org/x/tools/cmd/goimports \
golang.org/x/lint/golint \
golang.org/x/tools/gopls \
github.com/alecthomas/gometalinter \
honnef.co/go/tools/... \
github.com/golangci/golangci-lint/cmd/golangci-lint \
github.com/mgechev/revive \
github.com/derekparker/delve/cmd/dlv 2>&1
ENV GO111MODULE=on ENV GO111MODULE=on
# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog

View File

@ -3,9 +3,9 @@
"service": "neko", "service": "neko",
"dockerComposeFile": "docker-compose.yaml", "dockerComposeFile": "docker-compose.yaml",
"workspaceFolder": "/workspace", "workspaceFolder": "/workspace",
"remoteUser": "vscode", "remoteUser": "neko",
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash", "terminal.integrated.shell.linux": "/bin/ash",
"go.gopath": "/go" "go.gopath": "/go"
}, },
"extensions": [ "extensions": [

View File

@ -1,4 +1,4 @@
version: '3.6' version: '2.0'
services: services:
neko: neko:
network_mode: host network_mode: host
@ -11,6 +11,7 @@ services:
security_opt: security_opt:
- seccomp:unconfined - seccomp:unconfined
volumes: volumes:
- /home/neko/src:/workspace - /home/nurd/neko:/workspace
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
command: "/bin/sh -c \"while sleep 1000; do :; done\"" command: "/bin/sh -c \"while sleep 1000; do :; done\""

View File

@ -1,6 +0,0 @@
#!/bin/bash
sudo /etc/init.d/dbus start
echo "Starting supervisord"
/usr/bin/supervisord -c /etc/neko/supervisord.conf

4
.docker/files/dbus Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
rm -rf /var/run/dbus.pid
/usr/bin/dbus-daemon --nofork --print-pid --config-file=/usr/share/dbus-1/system.conf

View File

@ -28,7 +28,7 @@
}, },
{ {
"Title": "9Anime", "Title": "9Anime",
"URL": "https://9anime.to/", "URL": "https://9anime.xyz/",
"Favicon": "https://staticf.akacdn.ru/assets/favicons/favicon.png", "Favicon": "https://staticf.akacdn.ru/assets/favicons/favicon.png",
"Folder": "Media", "Folder": "Media",
"Placement": "toolbar" "Placement": "toolbar"

View File

@ -640,7 +640,7 @@
<!-- default menu file (or custom one in $HOME/.config/openbox/) --> <!-- default menu file (or custom one in $HOME/.config/openbox/) -->
<!-- system menu files on Debian systems --> <!-- system menu files on Debian systems -->
<file>/var/lib/openbox/debian-menu.xml</file> <!--file>/var/lib/openbox/debian-menu.xml</file-->
<file>menu.xml</file> <file>menu.xml</file>
<hideDelay>200</hideDelay> <hideDelay>200</hideDelay>
<!-- if a press-release lasts longer than this setting (in milliseconds), the <!-- if a press-release lasts longer than this setting (in milliseconds), the

View File

@ -0,0 +1,49 @@
[supervisord]
nodaemon=true
logfile=/dev/null
logfile_maxbytes=0
loglevel=debug
[program:dbus]
environment=HOME="/root",USER="root"
command=/usr/bin/dbus
redirect_stderr=true
autorestart=true
priority=100
user=root
[program:xvfb]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s
redirect_stderr=true
autorestart=true
priority=300
user=%(ENV_USER)s
[program:pulseaudio]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
autorestart=true
priority=300
user=%(ENV_USER)s
[program:openbox]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/openbox --config-file /etc/neko/openbox.xml
autorestart=true
priority=300
user=%(ENV_USER)s
[program:firefox-esr]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/lib/firefox/firefox --display=%(ENV_DISPLAY)s --setDefaultBrowser -width %(ENV_SCREEN_WIDTH)s -height %(ENV_SCREEN_HEIGHT)s
autorestart=true
priority=400
user=%(ENV_USER)s
[program:neko]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/neko serve -d --static "/var/www"
autorestart=true
priority=800
user=%(ENV_USER)s

View File

@ -1,31 +1,42 @@
[supervisord] [supervisord]
environment=PULSE_SERVER="unix:/tmp/pulseaudio.socket",DISPLAY=":%(ENV_NEKO_DISPLAY)s"
nodaemon=true nodaemon=true
logfile=/dev/null #logfile=/dev/null
logfile_maxbytes=0 #logfile_maxbytes=0
loglevel=debug loglevel=debug
[program:dbus]
environment=HOME="/root",USER="root"
command=/usr/bin/dbus
redirect_stderr=true
autorestart=true
priority=100
user=root
[program:xvfb] [program:xvfb]
command=/usr/bin/Xvfb :%(ENV_NEKO_DISPLAY)s -screen 0 %(ENV_NEKO_WIDTH)sx%(ENV_NEKO_HEIGHT)sx24+32 environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 %(ENV_SCREEN_WIDTH)sx%(ENV_SCREEN_HEIGHT)sx%(ENV_SCREEN_DEPTH)s
redirect_stderr=true
autorestart=true autorestart=true
priority=300 priority=300
user=%(ENV_USER)s
[program:pulseaudio] [program:pulseaudio]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1 command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
autorestart=true autorestart=true
priority=300 priority=300
user=%(ENV_USER)s
[program:openbox] [program:openbox]
environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/bin/openbox --config-file /etc/neko/openbox.xml command=/usr/bin/openbox --config-file /etc/neko/openbox.xml
autorestart=true autorestart=true
priority=300 priority=300
user=%(ENV_USER)s
[program:firefox-esr] [program:firefox-esr]
command=/usr/lib/firefox-esr/firefox-esr --kiosk --display=:%(ENV_NEKO_DISPLAY)s --setDefaultBrowser -width %(ENV_NEKO_WIDTH)s -height %(ENV_NEKO_HEIGHT)s %(ENV_NEKO_URL)s environment=HOME="/home/%(ENV_USER)s",USER="%(ENV_USER)s"
command=/usr/lib/firefox/firefox --display=%(ENV_DISPLAY)s --setDefaultBrowser -width %(ENV_SCREEN_WIDTH)s -height %(ENV_SCREEN_HEIGHT)s
autorestart=true autorestart=true
priority=400 priority=400
user=%(ENV_USER)s
[program:neko]
command=/usr/bin/neko serve -d --static "/var/www"
autorestart=true
priority=800

View File

@ -1,27 +0,0 @@
[supervisord]
environment=PULSE_SERVER="unix:/tmp/pulseaudio.socket",DISPLAY=":%(ENV_NEKO_DISPLAY)s"
nodaemon=true
#logfile=/dev/null
#logfile_maxbytes=0
loglevel=debug
[program:xvfb]
command=/usr/bin/Xvfb :%(ENV_NEKO_DISPLAY)s -screen 0 %(ENV_NEKO_WIDTH)sx%(ENV_NEKO_HEIGHT)sx24+32
redirect_stderr=true
autorestart=true
priority=300
[program:pulseaudio]
command=/usr/bin/pulseaudio --disallow-module-loading -vvvv --disallow-exit --exit-idle-time=-1
autorestart=true
priority=300
[program:openbox]
command=/usr/bin/openbox --config-file /etc/neko/openbox.xml
autorestart=true
priority=300
[program:firefox-esr]
command=/usr/lib/firefox-esr/firefox-esr --display=:%(ENV_NEKO_DISPLAY)s --setDefaultBrowser -width %(ENV_NEKO_WIDTH)s -height %(ENV_NEKO_HEIGHT)s %(ENV_NEKO_URL)s
autorestart=true
priority=400

View File

@ -13,20 +13,20 @@
# fi # fi
sudo mkdir -p /var/run/dbus /etc/neko sudo mkdir -p /var/run/dbus /etc/neko
sudo /etc/init.d/dbus start sudo rm -rf /var/run/dbus.pid
sudo cp default.pa /etc/pulse/default.pa sudo cp files/firefox/neko.js /usr/lib/firefox/mozilla.cfg
sudo cp files/firefox/autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js
sudo cp files/firefox/policies.json /usr/lib/firefox/distribution/policies.json
sudo cp firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg sudo cp files/dbus /usr/bin/dbus
sudo cp firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js sudo cp files/default.pa /etc/pulse/default.pa
sudo cp firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json sudo cp files/supervisord.conf /etc/neko/supervisord.conf
sudo cp files/openbox.xml /etc/neko/openbox.xml
sudo cp supervisord.conf /etc/neko/supervisord.conf if [ ! -f /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi ]; then
sudo cp openbox.xml /etc/neko/openbox.xml sudo mkdir -p /usr/lib/firefox/distribution/extensions
sudo curl -o /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi
if [ ! -f /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi ]; then
sudo mkdir -p /usr/lib/firefox-esr/distribution/extensions
sudo curl -o /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi
fi fi
sudo cp ../server/bin/neko /usr/bin/neko sudo cp ../server/bin/neko /usr/bin/neko
@ -38,13 +38,15 @@ sudo rm -rf /var/run/supervisord.pid
mkdir -p $HOME/.config/pulse mkdir -p $HOME/.config/pulse
echo "default-server=unix:/tmp/pulseaudio.socket" > $HOME/.config/pulse/client.conf echo "default-server=unix:/tmp/pulseaudio.socket" > $HOME/.config/pulse/client.conf
export NEKO_DISPLAY=0 export USER=vscode
export NEKO_WIDTH=1280 export SCREEN_WIDTH=1280
export NEKO_HEIGHT=720 export SCREEN_HEIGHT=720
export NEKO_URL=https://www.youtube.com/embed/QH2-TGUlwu4 export SCREEN_DEPTH=24
export DISPLAY=:99.0
export NEKO_PASSWORD=neko export NEKO_PASSWORD=neko
export NEKO_BIND=0.0.0.0:80 export NEKO_BIND=:8080
export NEKO_KEY= export NEKO_KEY=
export NEKO_CERT= export NEKO_CERT=
supervisord --configuration ./supervisord.dev.conf supervisord --configuration ./supervisord.conf

View File

@ -1,83 +1,120 @@
FROM debian:stretch-slim FROM frolvlad/alpine-glibc
ENV GST_VERSION=1.16.2
# build gstreamer
RUN apk add --no-cache --virtual .gst-build-deps \
build-base bison flex perl python glib-dev zlib-dev \
opus-dev \
pulseaudio-dev libx11-dev libxv-dev libxt-dev libxfixes-dev libvpx-dev \
git nasm openssl-dev \
#
# build gstreamer
&& cd /tmp \
&& wget "https://gstreamer.freedesktop.org/src/gstreamer/gstreamer-$GST_VERSION.tar.xz" \
&& tar xvfJ "gstreamer-$GST_VERSION.tar.xz" > /dev/null \
&& cd "gstreamer-$GST_VERSION" \
&& ./configure --prefix=/usr \
&& make && make install \
&& cd /tmp && rm -rf "gstreamer-$GST_VERSION" \
#
# build gst-plugins-base
&& wget "https://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-$GST_VERSION.tar.xz" \
&& tar xvfJ "gst-plugins-base-$GST_VERSION.tar.xz" > /dev/null \
&& cd "gst-plugins-base-$GST_VERSION" \
&& ./configure --prefix=/usr \
&& make && make install \
&& cd /tmp && rm -rf "gst-plugins-base-$GST_VERSION" \
#
# build gst-plugins-good
&& wget "https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-$GST_VERSION.tar.xz" \
&& tar xvfJ "gst-plugins-good-$GST_VERSION.tar.xz" > /dev/null \
&& cd "gst-plugins-good-$GST_VERSION" \
&& ./configure --prefix=/usr \
&& make && make install \
&& cd /tmp && rm -rf "gst-plugins-good-$GST_VERSION" \
#
# build openh264
&& git clone https://github.com/cisco/openh264.git \
&& cd openh264 \
&& make && make install \
&& cd /tmp && rm -rf openh264 \
#
# build gst-plugins-bad
&& wget "https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-$GST_VERSION.tar.xz" \
&& tar xvfJ "gst-plugins-bad-$GST_VERSION.tar.xz" > /dev/null \
&& cd "gst-plugins-bad-$GST_VERSION" \
&& ./configure --prefix=/usr \
&& make && make install \
&& cd /tmp && rm -rf "gst-plugins-bad-$GST_VERSION" \
#
# remove build deps
&& apk del .gst-build-deps
ARG USERNAME=neko ARG USERNAME=neko
ARG USER_UID=1000 ARG USER_UID=1000
ARG USER_GID=$USER_UID ARG USER_GID=$USER_UID
# Avoid warnings by switching to noninteractive # RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories
ENV DEBIAN_FRONTEND=noninteractive # RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
# RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
# Install dependencies ttf-freefont # install neko dependencies
RUN apt-get update \ RUN apk add --no-cache supervisor openbox dbus-x11 xvfb pulseaudio alsa-plugins-pulse opus libvpx libxv libxtst libxfixes xclip ttf-freefont \
&& apt-get -y install curl apt-utils supervisor openbox dbus-x11 xvfb pulseaudio firefox-esr \ && apk add --no-cache libevent --repository "http://dl-cdn.alpinelinux.org/alpine/edge/main" \
&& apt-get -y install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-pulseaudio \ && apk add --no-cache firefox-esr --repository "http://dl-cdn.alpinelinux.org/alpine/edge/community" \
&& apt-get -y install libxcb-xkb-dev libxkbcommon-x11-dev xclip \
# #
# Create a non-root user # create a non-root user
&& groupadd --gid $USER_GID $USERNAME \ && addgroup -g $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME \ && adduser -D -u $USER_UID -G $USERNAME -s /bin/ash -h /home/$USERNAME $USERNAME \
&& adduser $USERNAME audio \ && adduser $USERNAME audio \
&& adduser $USERNAME video \ && adduser $USERNAME video \
&& adduser $USERNAME pulse \ && adduser $USERNAME pulse \
# #
# Add sudo support for the non-root user # install uBlock
&& apt-get install -y sudo \ && mkdir -p /usr/lib/firefox/distribution/extensions \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ && wget -O /usr/lib/firefox/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# #
# Install uBlock # setup pulseaudio
&& mkdir -p /usr/lib/firefox-esr/distribution/extensions \
&& curl -o /usr/lib/firefox-esr/distribution/extensions/uBlock0@raymondhill.net.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi \
#
# Setup Pulse Audio
&& mkdir -p /home/$USERNAME/.config/pulse/ \ && mkdir -p /home/$USERNAME/.config/pulse/ \
&& echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf \ && echo "default-server=unix:/tmp/pulseaudio.socket" > /home/$USERNAME/.config/pulse/client.conf \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME \ && chown -R $USERNAME:$USERNAME /home/$USERNAME \
# #
# Workaround for an X11 problem. See: http://blog.tigerteufel.de/?p=476 # 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/ \ && mkdir /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix && chown $USERNAME /tmp/.X11-unix/ \
# #
# Make directories for neko # make directories for neko
&& mkdir -p /etc/neko /var/www \ && mkdir -p /etc/neko /var/www
#
# Clean up
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# #
# Copy configuation files # env
COPY .docker/openbox.xml /etc/neko/openbox.xml ENV USER=$USERNAME
COPY .docker/supervisord.conf /etc/neko/supervisord.conf ENV SCREEN_WIDTH=1280
COPY .docker/default.pa /etc/pulse/default.pa ENV SCREEN_HEIGHT=720
COPY .docker/firefox/neko.js /usr/lib/firefox-esr/mozilla.cfg ENV SCREEN_DEPTH=24
COPY .docker/firefox/autoconfig.js /usr/lib/firefox-esr/defaults/pref/autoconfig.js ENV DISPLAY=:99.0
COPY .docker/firefox/policies.json /usr/lib/firefox-esr/distribution/policies.json
# #
# Neko files # copy configuation files
COPY .docker/files/dbus /usr/bin/dbus
COPY .docker/files/openbox.xml /etc/neko/openbox.xml
COPY .docker/files/supervisord.conf /etc/neko/supervisord.conf
COPY .docker/files/default.pa /etc/pulse/default.pa
COPY .docker/files/firefox/neko.js /usr/lib/firefox/mozilla.cfg
COPY .docker/files/firefox/autoconfig.js /usr/lib/firefox/defaults/pref/autoconfig.js
COPY .docker/files/firefox/policies.json /usr/lib/firefox/distribution/policies.json
#
# neko files
COPY client/dist/ /var/www COPY client/dist/ /var/www
COPY server/bin/neko /usr/bin/neko COPY server/bin/neko /usr/bin/neko
USER $USERNAME
# #
# Neko Env # neko env
ENV NEKO_USER=$USERNAME
ENV NEKO_DISPLAY=0
ENV NEKO_WIDTH=1280
ENV NEKO_HEIGHT=720
ENV NEKO_PASSWORD=neko ENV NEKO_PASSWORD=neko
ENV NEKO_ADMIN=admin ENV NEKO_ADMIN=admin
ENV NEKO_BIND=:8080 ENV NEKO_BIND=:8080
# Neko Nyan (=^-ω-^=)
ENV NEKO_URL=https://www.youtube.com/embed/QH2-TGUlwu4
# #
# Copy entrypoint # run neko
COPY .docker/entrypoint.sh /entrypoint.sh CMD ["/usr/bin/supervisord", "-c", "/etc/neko/supervisord.conf"]
#
# Run Service
CMD ["/bin/bash", "/entrypoint.sh"]

View File

@ -1,3 +1 @@
DISPLAY=:0 DISPLAY=:99.0
PULSE_SERVER=unix:/tmp/pulseaudio.socket
GST_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/gstreamer-1.0/

View File

@ -187,6 +187,7 @@ func (p *Pipeline) Stop() {
C.gstreamer_send_stop_pipeline(p.Pipeline) C.gstreamer_send_stop_pipeline(p.Pipeline)
} }
// gst-inspect-1.0
func CheckPlugins(plugins []string) error { func CheckPlugins(plugins []string) error {
var plugin *C.GstPlugin var plugin *C.GstPlugin
for _, pluginstr := range plugins { for _, pluginstr := range plugins {