Skip to content

Commit

Permalink
Simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
gorvin committed May 12, 2017
1 parent 654709f commit 8a24645
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 58 deletions.
6 changes: 4 additions & 2 deletions experimental/Dockerfile.chrome
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ RUN wget --no-verbose -O /tmp/chromedriver_linux64.zip https://chromedriver.stor

RUN mv /usr/bin/google-chrome /usr/bin/google-chrome-with-sandbox \
&& echo '#!/usr/bin/env bash\necho $0 $@>>google-chrome.log\nexec -a "$0" "/usr/bin/google-chrome-with-sandbox" --no-sandbox "$@" 2>&1 | tee ~/google-chrome-exec.log'> /usr/bin/google-chrome-no-sandbox \
&& chmod +x /usr/bin/google-chrome-no-sandbox \
&& chmod a+x /usr/bin/google-chrome-no-sandbox \
&& ln -s /usr/bin/google-chrome-no-sandbox /usr/bin/google-chrome \
&& mv /opt/google/chrome/google-chrome /opt/google/chrome/google-chrome-with-sandbox \
&& echo '#!/usr/bin/env bash\necho $0 $@>>google-chrome-opt.log\nexec -a "$0" "$0-with-sandbox" --no-sandbox "$@" 2>&1 | tee ~/google-chrome-opt-exec.log '> /opt/google/chrome/google-chrome \
&& chmod +x /opt/google/chrome/google-chrome \
&& chmod a+x /opt/google/chrome/google-chrome \
&& sed -e "s|^\( *\)\([[]submenu[]] [(]Applications[)] {}.*\)$|\1[exec] (Google Chrome) {/opt/google/chrome/google-chrome} </opt/google/chrome/product_logo_32.xpm>\n\1\2|" -i /etc/X11/fluxbox/fluxbox-menu

ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

USER ${APP_USER}

# script to be loaded in entry_node.sh and chrome start script with --no-sandbox flag
Expand Down
2 changes: 2 additions & 0 deletions experimental/Dockerfile.firefox
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ RUN wget --no-verbose -O /tmp/geckodriver.tar.gz https://github.com/mozilla/geck
RUN update-alternatives --install /usr/bin/x-www-browser x-www-browser /usr/bin/firefox 40 \
&& sed -e "s|^\( *\)\([[]submenu[]] [(]Applications[)] {}.*\)$|\1[exec] (Firefox) {/usr/bin/firefox} </opt/firefox/browser/chrome/icons/default/default48.png>\n\1\2|" -i /etc/X11/fluxbox/fluxbox-menu

ENV DBUS_SESSION_BUS_ADDRESS=/dev/null

USER ${APP_USER}

# script to be loaded in entry_node.sh
Expand Down
62 changes: 26 additions & 36 deletions experimental/Dockerfile.japp
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
FROM ubuntu:16.04
LABEL authors="IgorV <[email protected]>"

ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true
ARG APP_USER=app
ARG APP_LANG="en_US.UTF-8"
ARG APP_LANGUAGE="en_US:en"
ARG APP_LC_ALL="en_US.UTF-8"

RUN apt-get update -qqy \
&& apt-get install -qqy --no-install-recommends apt-utils \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*
ENV DEBIAN_FRONTEND=noninteractive \
DEBCONF_NONINTERACTIVE_SEEN=true \
TZ="UTC" \
APP_USER=${APP_USER} \
APP_HOME="/home/${APP_USER}" \
TERM=linux

# Locale
RUN apt-get update -qqy \
&& apt-get install -qqy --no-install-recommends \
language-pack-en \
apt-utils \
&& apt-get install -qqy --no-install-recommends \
locales \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& locale-gen --purge "en_US.UTF-8" \
&& update-locale LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8" \
&& dpkg-reconfigure --frontend noninteractive locales

ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US:en" \
LC_ALL="en_US.UTF-8" \
TZ="UTC"

# Timezone
RUN apt-get update -qqy \
&& apt-get install -qqy --no-install-recommends tzdata \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& locale-gen --purge "${APP_LANG}" \
&& update-locale LANG="${APP_LANG}" LANGUAGE="${APP_LANGUAGE}" LC_ALL="${APP_LC_ALL}" \
&& dpkg-reconfigure --frontend noninteractive locales \
&& apt-get install -qqy --no-install-recommends \
language-pack-en \
tzdata \
&& echo "${TZ}" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata

# Common tools
RUN apt-get update -qqy \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& apt-get install -qqy --no-install-recommends \
bzip2 \
curl \
Expand All @@ -40,19 +34,15 @@ RUN apt-get update -qqy \
openjdk-8-jre-headless \
unzip \
wget \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/* \
&& sed -e 's/securerandom\.source=file:\/dev\/random/securerandom\.source=file:\/dev\/urandom/' \
-i ./usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

ARG APP_USER=app
ENV APP_USER=${APP_USER} \
APP_HOME="/home/${APP_USER}" \
TERM=linux
-i /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security \
&& adduser --disabled-password --uid 899 --home ${APP_HOME} --gecos '' ${APP_USER} \
&& passwd -d ${APP_USER} \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

# Add app user
RUN adduser --disabled-password --uid 899 --home ${APP_HOME} --gecos '' ${APP_USER} \
&& adduser ${APP_USER} sudo \
&& passwd -d ${APP_USER}
ENV LANG=${LOCALE_LANG} \
LANGUAGE=${LOCALE_LANGUAGE} \
LC_ALL=${LOCALE_LC_ALL}

WORKDIR ${APP_HOME}

Expand Down
29 changes: 11 additions & 18 deletions experimental/Dockerfile.jappx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@ FROM bravo/japp:1.0
LABEL authors="IgorV <[email protected]>"

# xpra and xorg-video-dummy with dependencies

USER root

ENV DISPLAY=":100.0" \
SCREEN_WIDTH=1360 \
SCREEN_HEIGHT=1020

RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe\n" > /etc/apt/sources.list \
&& echo "deb http://archive.ubuntu.com/ubuntu xenial-updates main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://security.ubuntu.com/ubuntu xenial-security main universe\n" >> /etc/apt/sources.list \
&& echo "deb http://winswitch.org/ xenial main" > /etc/apt/sources.list.d/winswitch.list \
&& curl http://winswitch.org/gpg.asc | apt-key add - \
&& apt-get update -qqy \
&& apt-get -qqy --no-install-recommends install \
&& apt-get install -qqy --no-install-recommends \
dbus-x11 \
fluxbox \
fonts-ipafont-gothic \
Expand All @@ -29,27 +35,14 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu xenial main universe\n" > /etc/ap
xserver-xorg-input-void \
xserver-xorg-video-dummy \
xterm \
&& sed -e "s/^\( *\)\(Virtual.*\)$/\1#\2\n\1Virtual ${SCREEN_WIDTH} ${SCREEN_HEIGHT}/" -i /etc/xpra/xorg.conf \
&& mkdir -p /tmp/.X11-unix /run/dbus \
&& chmod -R a+rwx /tmp/.X11-unix /run/dbus \
&& su -l ${APP_USER} -c "touch ${APP_HOME}/.Xmodmap ${APP_HOME}/.Xauthority && mkdir -p ${APP_HOME}/.fluxbox && echo background: unset >> ${APP_HOME}/.fluxbox/overlay" \
&& rm -rf /var/lib/apt/lists/* /var/cache/apt/*

RUN mkdir -p /tmp/.X11-unix \
&& chmod -R +rwx /tmp/.X11-unix \
&& mkdir -p /run/dbus \
&& chmod -R +rwx /run/dbus

USER ${APP_USER}

ENV DISPLAY=":100.0" \
SCREEN_WIDTH=1360 \
SCREEN_HEIGHT=1020

# Minimal Xorg configuration
#ADD http://xpra.org/xorg.conf ${APP_HOME}/xorg.conf
COPY xorg.conf ${APP_HOME}/
RUN touch ${APP_HOME}/.Xmodmap \
&& touch ${APP_HOME}/.Xauthority \
&& mkdir -p ${APP_HOME}/.fluxbox \
&& echo "background: unset" >> ${APP_HOME}/.fluxbox/overlay

# In container:
# Test1: xpra --no-daemon --no-mdns --no-pulseaudio start :100 --start-child=glxgears
# Test2: xpra --no-daemon --no-mdns --no-pulseaudio --xvfb="Xorg -dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile /home/app/.xpra/Xvfb-10.log -config /home/app/xorg.conf" start :100 --start-child=glxgears
Expand Down
3 changes: 1 addition & 2 deletions experimental/entry_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ NODE_LAUNCH_ARGS="org.openqa.grid.selenium.GridLauncherV3 \
${SE_OPTS}"

rm -f /tmp/.X*lock
sed -e "s|Virtual 1360 1020|Virtual ${SCREEN_WIDTH} ${SCREEN_HEIGHT}|" -i "${HOME}/xorg.conf"
XORG_ARGS="-dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/XpraXorg-10.log -config ${HOME}/xorg.conf"
XORG_ARGS="-dpi 96 -noreset -nolisten tcp +extension GLX +extension RANDR +extension RENDER -logfile ${HOME}/XpraXorg${DISPLAY}.log -config /etc/xpra/xorg.conf"

set -x

Expand Down

0 comments on commit 8a24645

Please sign in to comment.