init
This commit is contained in:
commit
15e4efc356
4 files changed
+206
No files matched your search
+99
@@ -0,0 +1,99 @@
|
|||||||
|
FROM debian:stretch
|
||||||
|
|
||||||
|
RUN echo 'deb http://deb.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
RUN apt-get -qq update \
|
||||||
|
&&apt-get install -y gnupg2 \
|
||||||
|
x11vnc \
|
||||||
|
xvfb \
|
||||||
|
fluxbox \
|
||||||
|
wget \
|
||||||
|
curl \
|
||||||
|
wmctrl \
|
||||||
|
dbus-x11 \
|
||||||
|
gconf-service \
|
||||||
|
libasound2 \
|
||||||
|
libatk1.0-0 \
|
||||||
|
libc6 \
|
||||||
|
libcairo2 \
|
||||||
|
libcups2 \
|
||||||
|
libdbus-1-3 \
|
||||||
|
libexpat1 \
|
||||||
|
libfontconfig1 \
|
||||||
|
libgcc1 \
|
||||||
|
libgconf-2-4 \
|
||||||
|
libgdk-pixbuf2.0-0 \
|
||||||
|
libglib2.0-0 \
|
||||||
|
libgtk-3-0 \
|
||||||
|
libnspr4 \
|
||||||
|
libpango-1.0-0 \
|
||||||
|
libpangocairo-1.0-0 \
|
||||||
|
libstdc++6 \
|
||||||
|
libx11-6 \
|
||||||
|
libx11-xcb1 \
|
||||||
|
libxcb1 \
|
||||||
|
libxcomposite1 \
|
||||||
|
libxcursor1 \
|
||||||
|
libxdamage1 \
|
||||||
|
libxext6 \
|
||||||
|
libxfixes3 \
|
||||||
|
libxi6 \
|
||||||
|
libxrandr2 \
|
||||||
|
libxrender1 \
|
||||||
|
libxss1 \
|
||||||
|
libxtst6 \
|
||||||
|
fonts-ipafont-gothic \
|
||||||
|
fonts-wqy-zenhei \
|
||||||
|
fonts-thai-tlwg \
|
||||||
|
fonts-kacst \
|
||||||
|
ttf-freefont \
|
||||||
|
ca-certificates \
|
||||||
|
fonts-liberation \
|
||||||
|
libappindicator1 \
|
||||||
|
libnss3 \
|
||||||
|
lsb-release \
|
||||||
|
xdg-utils \
|
||||||
|
pulseaudio \
|
||||||
|
ffmpeg \
|
||||||
|
nano \
|
||||||
|
alsa-utils \
|
||||||
|
jackd2 \
|
||||||
|
pavucontrol
|
||||||
|
|
||||||
|
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
|
||||||
|
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
|
||||||
|
|
||||||
|
RUN apt-get -qq update \
|
||||||
|
&& apt-get -y install google-chrome-stable \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& apt-get purge --auto-remove -y curl
|
||||||
|
|
||||||
|
ENV LANG="C.UTF-8"
|
||||||
|
|
||||||
|
RUN useradd -m -G pulse-access chrome \
|
||||||
|
&& usermod -s /bin/bash chrome \
|
||||||
|
&& mkdir -p /home/chrome/.fluxbox \
|
||||||
|
&& echo ' \n\
|
||||||
|
#session.screen0.toolbar.visible: false\n\
|
||||||
|
#session.screen0.fullMaximization: true\n\
|
||||||
|
#session.screen0.maxDisableResize: true\n\
|
||||||
|
#session.screen0.maxDisableMove: true\n\
|
||||||
|
#session.screen0.defaultDeco: NONE\n\
|
||||||
|
' >> /home/chrome/.fluxbox/init \
|
||||||
|
&& chown -R chrome:chrome /home/chrome/.fluxbox
|
||||||
|
|
||||||
|
RUN rm /etc/machine-id && ln -s /var/lib/dbus/machine-id /etc/machine-id
|
||||||
|
RUN echo "DBUS_SESSION_BUS_ADDRESS=/dev/null" >> /etc/environment
|
||||||
|
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/dbus && dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address \
|
||||||
|
&& sed -i 's/load-module module-console-kit/#load-module module-console-kit/g' /etc/pulse/default.pa
|
||||||
|
|
||||||
|
COPY bootstrap.sh /
|
||||||
|
COPY stream.sh /
|
||||||
|
|
||||||
|
EXPOSE 5900
|
||||||
|
|
||||||
|
CMD '/bootstrap.sh'
|
||||||
Executable
+85
@@ -0,0 +1,85 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb
|
||||||
|
|
||||||
|
readonly G_LOG_I='[INFO]'
|
||||||
|
readonly G_LOG_W='[WARN]'
|
||||||
|
readonly G_LOG_E='[ERROR]'
|
||||||
|
|
||||||
|
main() {
|
||||||
|
launch_xvfb
|
||||||
|
launch_window_manager
|
||||||
|
run_vnc_server
|
||||||
|
}
|
||||||
|
|
||||||
|
launch_xvfb() {
|
||||||
|
# Set defaults if the user did not specify envs.
|
||||||
|
export DISPLAY=${XVFB_DISPLAY:-:0}
|
||||||
|
local screen=${XVFB_SCREEN:-0}
|
||||||
|
local resolution=${XVFB_RESOLUTION:-1280x720x24}
|
||||||
|
local timeout=${XVFB_TIMEOUT:-5}
|
||||||
|
|
||||||
|
# Start and wait for either Xvfb to be fully up or we hit the timeout.
|
||||||
|
Xvfb ${DISPLAY} -screen ${screen} ${resolution} &
|
||||||
|
local loopCount=0
|
||||||
|
until xdpyinfo -display ${DISPLAY} > /dev/null 2>&1
|
||||||
|
do
|
||||||
|
loopCount=$((loopCount+1))
|
||||||
|
sleep 1
|
||||||
|
if [ ${loopCount} -gt ${timeout} ]
|
||||||
|
then
|
||||||
|
echo "${G_LOG_E} xvfb failed to start."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
launch_window_manager() {
|
||||||
|
local timeout=${XVFB_TIMEOUT:-5}
|
||||||
|
|
||||||
|
# Start and wait for either fluxbox to be fully up or we hit the timeout.
|
||||||
|
fluxbox &
|
||||||
|
local loopCount=0
|
||||||
|
until wmctrl -m > /dev/null 2>&1
|
||||||
|
do
|
||||||
|
loopCount=$((loopCount+1))
|
||||||
|
sleep 1
|
||||||
|
if [ ${loopCount} -gt ${timeout} ]
|
||||||
|
then
|
||||||
|
echo "${G_LOG_E} fluxbox failed to start."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
run_vnc_server() {
|
||||||
|
local passwordArgument='-nopw'
|
||||||
|
|
||||||
|
if [ -n "${VNC_SERVER_PASSWORD}" ]
|
||||||
|
then
|
||||||
|
local passwordFilePath="${HOME}/x11vnc.pass"
|
||||||
|
if ! x11vnc -storepasswd "${VNC_SERVER_PASSWORD}" "${passwordFilePath}"
|
||||||
|
then
|
||||||
|
echo "${G_LOG_E} Failed to store x11vnc password."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
passwordArgument=-"-rfbauth ${passwordFilePath}"
|
||||||
|
echo "${G_LOG_I} The VNC server will ask for a password."
|
||||||
|
else
|
||||||
|
echo "${G_LOG_W} The VNC server will NOT ask for a password."
|
||||||
|
fi
|
||||||
|
|
||||||
|
x11vnc -display ${DISPLAY} -forever ${passwordArgument} &
|
||||||
|
wait $!
|
||||||
|
}
|
||||||
|
|
||||||
|
control_c() {
|
||||||
|
echo ""
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
trap control_c SIGINT SIGTERM SIGHUP
|
||||||
|
|
||||||
|
main
|
||||||
|
|
||||||
|
exit
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
: ${INRES:="1280x720"}
|
||||||
|
: ${FPS:="30"}
|
||||||
|
: ${GOP:="30"}
|
||||||
|
|
||||||
|
: ${OUTRES:="1280x720"}
|
||||||
|
: ${QUALITY:="ultrafast"}
|
||||||
|
: ${CBR:="2000k"}
|
||||||
|
|
||||||
|
: ${A_FREQ:="44100"}
|
||||||
|
: ${A_BITS:="128k"}
|
||||||
|
|
||||||
|
: ${SERVER:="rtmp://a.rtmp.youtube.com/live2/"}
|
||||||
|
|
||||||
|
ffmpeg \
|
||||||
|
-f alsa -ar "$A_FREQ" -ac 2 -i default \
|
||||||
|
-f x11grab -video_size "$INRES" -r "$FPS" -i :0 \
|
||||||
|
-c:v libx264 -preset "$QUALITY" -tune film -b:v "$CBR" -b:a "$A_BITS" -pix_fmt yuv420p -g "$GOP" \
|
||||||
|
-map 0:a -map 1:v \
|
||||||
|
-f flv "$SERVER$SERVER_KEY"
|
||||||
Reference in new issue
Block a user