forked from makidoll/shared-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.debian
117 lines (107 loc) · 4.03 KB
/
Dockerfile.debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# FROM debian:bullseye-slim
# https://github.com/canyanio/janus-gateway-docker
# https://hub.docker.com/r/canyan/janus-gateway
FROM canyan/janus-gateway:master_40f1ac66e95e1eed4bc91548e7187a1bb3ef3bd8
ENV DEBIAN_FRONTEND=noninteractive
RUN \
# update packages
apt-get update -y && \
apt-get install -y \
# install general
sudo bash wget curl procps \
# install desktop
xvfb xdotool dbus dbus-x11 pulseaudio fonts-roboto openbox xdg-utils xterm feh \
# install gstreamer
gstreamer1.0-tools gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
gstreamer1.0-pulseaudio gstreamer1.0-vaapi && \
# install nodejs and pm2
curl -o nodejs.sh -L https://deb.nodesource.com/setup_lts.x && \
bash nodejs.sh && \
rm -f nodejs.sh && \
apt-get install -y nodejs && \
npm i -g pm2 && \
# install caddy
curl -o /usr/bin/caddy -L https://caddyserver.com/api/download?os=linux\&arch=amd64 && \
chmod +x /usr/bin/caddy && \
# install google chrome
curl -OL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
apt-get install -y ./google-chrome-stable_current_amd64.deb && \
rm -f google-chrome-stable_current_amd64.deb && \
# create maki sudo user without password
useradd -m maki && usermod -L maki && \
echo "maki ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
chsh maki -s /bin/bash
# # cleanup (lets not so that users can still use apt)
# apt-get clean -y && \
# rm -rf /var/lib/apt/lists/* /var/cache/apt/*
USER maki
WORKDIR /home/maki
# install some extra apps
RUN \
sudo apt-get install -y jq unzip libatomic1 libgconf-2-4 libcanberra-gtk-module && \
mkdir -p popcorn-time && \
cd popcorn-time && \
wget $( \
curl https://api.github.com/repos/popcorn-official/popcorn-desktop/releases/latest | \
jq -r '.assets[] | select(.name | contains("-linux64.zip")) | .browser_download_url' \
) && \
unzip *-linux64.zip && \
rm -f *-linux64.zip
# install chrome extensions
COPY ./config/install-chrome-ext.sh /etc/shared-desktop/install-chrome-ext.sh
RUN cd /etc/shared-desktop && \
sudo ./install-chrome-ext.sh "cjpalhdlnbpafiamejdnhcphjbkeiagm" "uBlock Origin" && \
# sudo ./install-chrome-ext.sh "gphhapmejobijbbhgpjhcjognlahblep" "GNOME Shell integration" && \
sudo ./install-chrome-ext.sh "ghbmnnjooekpmoecnnnilnnbdlolhkhi" "Google Docs Offline" && \
sudo ./install-chrome-ext.sh "gbkeegbaiigmenfmjfclcdgdpimamgkj" "Office Editing for Docs, Sheets & Slides"
# copy janus config
COPY \
./config/janus.jcfg \
./config/janus.plugin.streaming.jcfg \
/usr/local/etc/janus/
# copy maki shared desktop config
COPY \
./config/ecosystem.config.js \
./config/Caddyfile \
./config/stream-h264-nvenc.sh \
./config/stream-h264-vaapi.sh \
./config/stream-h264.sh \
./config/stream-vp8.sh \
./config/background.jpg \
/etc/shared-desktop/
COPY ./app/ /etc/shared-desktop/app/
RUN \
# set background
mkdir -p .config/openbox && \
echo "feh --bg-fill /etc/shared-desktop/background.jpg" > .config/openbox/autostart && \
chmod +x .config/openbox/autostart && \
# vars
sudo bash -c "echo 'DISPLAY=:1' >> /etc/environment" && \
sudo bash -c "echo 'XDG_RUNTIME_DIR=/run/user/1000' >> /etc/environment" && \
sudo mkdir -p /var/run/dbus && \
# user
sudo mkdir -p /run/user/1000 && \
sudo chown maki:maki /run/user/1000 && \
# machine id
sudo rm -f /etc/machine-id /var/lib/dbus/machine-id && \
sudo dbus-uuidgen --ensure=/etc/machine-id && \
sudo dbus-uuidgen --ensure && \
# make google chrome default
sudo xdg-mime default google-chrome-stable.desktop x-scheme-handler/http && \
sudo xdg-mime default google-chrome-stable.desktop x-scheme-handler/https && \
sudo xdg-mime default google-chrome-stable.desktop text/html
ENV \
DESKTOP_RES=1366x768 \
STREAM_RES=1280x720 \
STREAM_BITRATE=4000 \
RTP_PORT_RANGE=10000-10200 \
XDG_RUNTIME_DIR=/run/user/1000 \
DISPLAY=:1 \
CODEC=h264 \
NVIDIA_VISIBLE_DEVICES=all \
NVIDIA_DRIVER_CAPABILITIES=compute,video,utility
# run config with pm2
RUN cd /etc/shared-desktop/app && sudo npm install --no-save
CMD sudo -E pm2-runtime start /etc/shared-desktop/ecosystem.config.js