init commit
parent
7c6d08ab6a
commit
89f2282832
@ -0,0 +1 @@
|
||||
res/
|
@ -0,0 +1,41 @@
|
||||
FROM ubuntu:18.10
|
||||
LABEL maintainer="urielCh <admin@uriel.ovh>"
|
||||
|
||||
ENV VNC_PASSWORD="" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
LC_ALL="C.UTF-8" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US.UTF-8"
|
||||
|
||||
ADD res/setup_10.x /tmp/
|
||||
# ADD res/google-chrome-stable_current_amd64.deb /tmp/
|
||||
|
||||
# dpkg -i /tmp/google-chrome-stable_current_amd64.deb &&\
|
||||
RUN \
|
||||
sed -i s@http://archive\.ubuntu\.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@ /etc/apt/sources.list &&\
|
||||
apt-get update && apt-get install -y --no-install-recommends apt-utils gnupg2 &&\
|
||||
cat /tmp/setup_10.x | bash - &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y curl xvfb nodejs fonts-takao pulseaudio supervisor x11vnc xdg-utils libnss3 wget libnspr4 libcairo2 libatk1.0-0 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libpango-1.0-0 chromium-browser &&\
|
||||
apt-get clean &&\
|
||||
rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/* /tmp/setup_10.x
|
||||
|
||||
RUN useradd --create-home --groups pulse-access --password chrome chrome &&\
|
||||
{ echo "chrome"; echo "chrome"; } | passwd chrome &&\
|
||||
chown -R chrome:chrome /home/chrome/
|
||||
|
||||
ADD /res/plugin /home/chrome/plugin
|
||||
ADD /res/webRobotJS /home/chrome/webRobotJS
|
||||
# RUN apt-get install -y xvfb && echo rm -rf /tmp/*
|
||||
#RUN apt-get update && apt-get install -y && dpkg -i /tmp/google-chrome-stable_current_amd64.deb
|
||||
ADD conf/ /
|
||||
|
||||
RUN chmod +x /*.sh
|
||||
|
||||
VOLUME ["/home/chrome"]
|
||||
|
||||
EXPOSE 5900
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
|
||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
@ -0,0 +1,38 @@
|
||||
# docker rm -f chrome; docker build -f 2.Dockerfile -t urielch/chrome-vnc2 .; docker run -t -i -p 5900:5900 --name chrome urielch/chrome-vnc2;
|
||||
FROM ubuntu:18.10
|
||||
LABEL maintainer="urielCh <admin@uriel.ovh>"
|
||||
|
||||
ENV VNC_PASSWORD="" \
|
||||
DEBIAN_FRONTEND="noninteractive" \
|
||||
LC_ALL="C.UTF-8" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US.UTF-8"
|
||||
|
||||
ADD res/setup_10.x /tmp/
|
||||
# ADD res/google-chrome-stable_current_amd64.deb /tmp/
|
||||
# dpkg -i /tmp/google-chrome-stable_current_amd64.deb &&\
|
||||
RUN \
|
||||
sed -i s@http://archive\.ubuntu\.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@ /etc/apt/sources.list &&\
|
||||
apt-get update && apt-get install -y --no-install-recommends apt-utils gnupg2 &&\
|
||||
cat /tmp/setup_10.x | bash - &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y curl xvfb nodejs pulseaudio x11vnc xdg-utils libnss3 wget libnspr4 libcairo2 libatk1.0-0 fonts-liberation libappindicator3-1 libatk-bridge2.0-0 libpango-1.0-0 fluxbox wmctrl chromium-browser &&\
|
||||
apt-get clean &&\
|
||||
rm -rf /var/cache/* /var/log/apt/* /var/lib/apt/lists/* /tmp/setup_10.x
|
||||
|
||||
RUN useradd --create-home --groups pulse-access --password chrome chrome &&\
|
||||
{ echo "chrome"; echo "chrome"; } | passwd chrome &&\
|
||||
chown -R chrome:chrome /home/chrome/
|
||||
|
||||
ADD /res/plugin /home/chrome/plugin
|
||||
ADD /res/webRobotJS /home/chrome/webRobotJS
|
||||
ADD conf/ /
|
||||
|
||||
# build from windows platform
|
||||
RUN chmod +x /*.sh
|
||||
USER chrome
|
||||
EXPOSE 5900
|
||||
|
||||
# ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
|
||||
ENTRYPOINT ["/chomevnc.sh"]
|
@ -0,0 +1,122 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Based on: http://www.richud.com/wiki/Ubuntu_Fluxbox_GUI_with_x11vnc_and_Xvfb
|
||||
|
||||
[ -f /run/secrets/URL ] && URL="$(cat /run/secrets/URL)"
|
||||
URL="${URL:-https://www.docker.com/}"
|
||||
VNC_SERVER_PASSWORD=${VNC_SERVER_PASSWORD:-/run/secrets/vncpasswd}
|
||||
#X11_W=${X11_W:-1920}
|
||||
#X11_H=${X11_H:-1080}
|
||||
|
||||
main() {
|
||||
log_i "Starting xvfb virtual display..."
|
||||
launch_xvfb
|
||||
log_i "Starting window manager..."
|
||||
launch_window_manager
|
||||
log_i "Starting VNC server..."
|
||||
run_vnc_server
|
||||
log_i "Starting Chrome..."
|
||||
launch_chrome
|
||||
}
|
||||
|
||||
launch_xvfb() {
|
||||
local xvfbLockFilePath="/tmp/.X1-lock"
|
||||
if [ -f "${xvfbLockFilePath}" ]
|
||||
then
|
||||
log_i "Removing xvfb lock file '${xvfbLockFilePath}'..."
|
||||
if ! rm -v "${xvfbLockFilePath}"
|
||||
then
|
||||
log_e "Failed to remove xvfb lock file"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set defaults if the user did not specify envs.
|
||||
export DISPLAY=${XVFB_DISPLAY:-:1}
|
||||
local screen=${XVFB_SCREEN:-0}
|
||||
local resolution=${XVFB_RESOLUTION:-1280x960x24}
|
||||
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
|
||||
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
|
||||
log_e "fluxbox failed to start"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
run_vnc_server() {
|
||||
local passwordArgument='-nopw'
|
||||
|
||||
if [ -e "${VNC_SERVER_PASSWORD}" ]
|
||||
then
|
||||
export X11VNC_AUTH="-rfbauth ${VNC_SERVER_PASSWORD}"
|
||||
log_i "The VNC server will ask for a password"
|
||||
else
|
||||
log_w "The VNC server will NOT ask for a password"
|
||||
fi
|
||||
|
||||
x11vnc -ncache 10 -display ${DISPLAY} -wait 20 -forever ${X11VNC_AUTH} &
|
||||
# wait $!
|
||||
}
|
||||
|
||||
launch_chrome() {
|
||||
export HOME="/home/chrome"
|
||||
export USER="chrome"
|
||||
/chrome.sh
|
||||
# wait $!
|
||||
}
|
||||
|
||||
|
||||
|
||||
log_i() {
|
||||
log "[INFO] ${@}"
|
||||
}
|
||||
|
||||
log_w() {
|
||||
log "[WARN] ${@}"
|
||||
}
|
||||
|
||||
log_e() {
|
||||
log "[ERROR] ${@}"
|
||||
}
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] ${@}"
|
||||
}
|
||||
|
||||
control_c() {
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
trap control_c SIGINT SIGTERM SIGHUP
|
||||
|
||||
main
|
||||
|
||||
exit
|
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -f /run/secrets/URL ] && URL="$(cat /run/secrets/URL)"
|
||||
URL="${URL:-https://www.docker.com/}"
|
||||
# /usr/bin/google-chrome-stable
|
||||
/usr/bin/chromium-browser \
|
||||
--clear-token-service \
|
||||
--disable-background-mode \
|
||||
--disable-gpu \
|
||||
--disable-infobars \
|
||||
--disable-metrics \
|
||||
--disable-preconnect \
|
||||
--disable-speech-api \
|
||||
--disable-sync \
|
||||
--disable-sync-app-list \
|
||||
--disable-translate \
|
||||
--disable-voice-input \
|
||||
--disable-webgl \
|
||||
--disable-web-security \
|
||||
--force-device-scale-factor=1 \
|
||||
--ignore-certificate-errors \
|
||||
--load-extension=/home/chrome/plugin \
|
||||
--no-first-run \
|
||||
--no-pings \
|
||||
--no-sandbox \
|
||||
--reset-variation-state \
|
||||
--user-data-dir \
|
||||
--window-position=0,0 \
|
||||
--window-size=${X11_W},${X11_H} \
|
||||
"${URL}"
|
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
echo ENTRY POINT
|
||||
# VNC default no password
|
||||
export X11VNC_AUTH="-nopw"
|
||||
|
||||
#touch /opt/vncpasswd
|
||||
#echo "chrome" | vncpasswd -f > /opt/vncpasswd
|
||||
|
||||
# look for VNC password file in order (first match is used)
|
||||
passwd_files=(
|
||||
/home/chrome/.vnc/passwd
|
||||
/run/secrets/vncpasswd
|
||||
# /opt/vncpasswd
|
||||
)
|
||||
|
||||
for passwd_file in ${passwd_files[@]}; do
|
||||
if [[ -f ${passwd_file} ]]; then
|
||||
export X11VNC_AUTH="-rfbauth ${passwd_file}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# override above if VNC_PASSWORD env var is set (insecure!)
|
||||
if [[ "$PASSWORD" != "" ]]; then
|
||||
export X11VNC_AUTH="-passwd $PASSWORD"
|
||||
fi
|
||||
|
||||
[ -z $X11_W ] && X11_W=1920
|
||||
[ -z $X11_H ] && X11_H=1080
|
||||
export X11_W
|
||||
export X11_H
|
||||
|
||||
exec "$@"
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
X11_W=${X11_W:-1920}
|
||||
X11_H=${X11_H:-1080}
|
@ -0,0 +1,45 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
|
||||
[program:xvfb]
|
||||
command=/xvfb.sh
|
||||
autorestart=true
|
||||
priority=100
|
||||
|
||||
[program:chromium-browser]
|
||||
environment=HOME="/home/chrome",DISPLAY=":1",USER="chrome"
|
||||
command=/chrome.sh
|
||||
user=chrome
|
||||
autorestart=true
|
||||
priority=200
|
||||
|
||||
[program:node]
|
||||
environment=HOME="/home/chrome",DISPLAY=":1",USER="chrome"
|
||||
directory=/home/chrome/webRobotJS
|
||||
command=/usr/bin/node zService.js
|
||||
user=chrome
|
||||
autorestart=true
|
||||
priority=200
|
||||
|
||||
[program:x11vnc]
|
||||
command=/usr/bin/x11vnc -display :1 %(ENV_X11VNC_AUTH)s -wait 5 -forever -xrandr
|
||||
user=chrome
|
||||
autorestart=true
|
||||
priority=300
|
||||
|
||||
#[program:xrdp-sesman]
|
||||
#command=/usr/sbin/xrdp-sesman --nodaemon
|
||||
#user=root
|
||||
#process_name = xrdp-sesman
|
||||
#autorestart=true
|
||||
#priority=400
|
||||
|
||||
#[program:xrdp]
|
||||
##command=/usr/sbin/xrdp -nodaemon
|
||||
#command=/etc/init.d/xrdp restart
|
||||
#user=root
|
||||
#process_name = xrdp
|
||||
#autorestart=true
|
||||
#stderr_logfile=/var/log/xrdp-error.log
|
||||
#stdout_logfile=/var/log/xrdp.log
|
||||
#priority=500
|
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
. /env.sh
|
||||
/usr/bin/Xvfb :1 -screen 0 ${X11_W}x${X11_H}x24 +extension RANDR
|
@ -0,0 +1,42 @@
|
||||
FROM ubuntu:18.10
|
||||
LABEL maintainer="urielCh <admin@uriel.ovh>"
|
||||
|
||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
||||
LC_ALL="C.UTF-8" \
|
||||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US.UTF-8"
|
||||
|
||||
RUN \
|
||||
sed -i s@http://archive\.ubuntu\.com/ubuntu/@mirror://mirrors.ubuntu.com/mirrors.txt@ /etc/apt/sources.list &&\
|
||||
apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends git curl ca-certificates apt-utils gnupg2 build-essential libxtst-dev libpng++-dev &&\
|
||||
curl https://deb.nodesource.com/setup_10.x -o /setup_10.x &&\
|
||||
chmod +x /setup_10.x && /setup_10.x &&\
|
||||
apt-get install -y nodejs &&\
|
||||
apt-get clean && rm -rf /var/cache/* /var/log/* /var/lib/apt/lists/*
|
||||
# apt update &&\
|
||||
|
||||
RUN \
|
||||
git clone https://github.com/UrielCh/webRobotJS &&\
|
||||
cd webRobotJS &&\
|
||||
rm -rf .git &&\
|
||||
npm install && cd .. &&\
|
||||
git clone https://github.com/UrielCh/zombie-plugin &&\
|
||||
cd zombie-plugin &&\
|
||||
rm -rf .git &&\
|
||||
npm install &&\
|
||||
npm install -g typescript browserify &&\
|
||||
tsc -p . &&\
|
||||
cp ./built/client.js ./dist/js/client.js &&\
|
||||
browserify ./built/popup.js > ./dist/js/popup.js &&\
|
||||
browserify ./built/background.js > ./dist/js/background.js &&\
|
||||
cd ..
|
||||
# echo 'curl https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /opt/google-chrome-stable_current_amd64.deb' >> dl.sh &&\
|
||||
RUN \
|
||||
echo '#!/bin/bash' > /dl.sh &&\
|
||||
echo 'cp -r /webRobotJS /opt' >> dl.sh &&\
|
||||
echo 'cp -r /zombie-plugin/dist /opt/plugin' >> dl.sh &&\
|
||||
echo 'cp /setup_10.x /opt' >> dl.sh &&\
|
||||
echo 'echo All Done' >> dl.sh &&\
|
||||
chmod +x /dl.sh
|
||||
|
||||
WORKDIR /opt
|
Loading…
Reference in New Issue