Skip to content

Commit

Permalink
(#77) separated image into Sakuli base and Sakuli installation image
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffle committed Oct 29, 2020
1 parent e83ad71 commit 373a28f
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 12 deletions.
42 changes: 42 additions & 0 deletions Dockerfile.sakuli
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This Dockerfile is used to build the Sakuli image from sakuli-base

FROM taconsol/sakuli-base

ARG SAKULI_VERSION
ARG NPM_ACCESS_TOKEN
ARG BUILD_DATE

# Ensure mandatory args are set
RUN test -n "${SAKULI_VERSION}" && \
test -n "${NPM_ACCESS_TOKEN}" && \
test -n "${BUILD_DATE}"

LABEL maintainer="simon.hofmann@consol.de" \
io.k8s.description="Sakuli Test Container with OpenBox window manager" \
io.k8s.display-name="Sakuli Test Container based on Ubuntu" \
io.openshift.expose-services="6901:http,5901:xvnc" \
io.openshift.tags="vnc, ubuntu, openbox" \
io.openshift.non-scalable=true

ENV REFRESHED_AT=${BUILD_DATE} \
IMG=taconsol/sakuli \
NPM_TOKEN=REPLACE_WITH_YOUR_NPM_TOKEN \
SAKULI_EXECUTION_DIR=/testsuite_execution \
LOG_MODE=ci

USER 0

### Create SAKULI_EXECUTION_DIR and set permissions correctly
RUN mkdir ${SAKULI_EXECUTION_DIR} && chmod 777 ${SAKULI_EXECUTION_DIR}

COPY ./src/sakuli/sakuli.sh $INST_SCRIPTS/
RUN chmod a+x $INST_SCRIPTS/sakuli.sh

USER 1000:1000

### Install Sakuli
RUN $INST_SCRIPTS/sakuli.sh $SAKULI_VERSION $NPM_ACCESS_TOKEN

RUN $INST_SCRIPTS/startup.sh

ENTRYPOINT ["/dockerstartup/startup.sh"]
113 changes: 113 additions & 0 deletions Dockerfile.sakuli-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# This Dockerfile is used to build an headles vnc image based on Ubuntu
# Used to run CI jobs for nut.js
ARG BASE_IMAGE_VERSION=18.04
FROM ubuntu:$BASE_IMAGE_VERSION

ARG NODE_VERSION
ARG BUILD_DATE

# Ensure mandatory args are set
RUN test -n "${NODE_VERSION}" && \
test -n "${BUILD_DATE}"

LABEL maintainer="simon.hofmann@consol.de" \
io.k8s.description="Sakuli Base Container with OpenBox window manager" \
io.k8s.display-name="Sakuli Base Container based on Ubuntu" \
io.openshift.expose-services="6901:http,5901:xvnc" \
io.openshift.tags="vnc, ubuntu, openbox" \
io.openshift.non-scalable=true

ENV REFRESHED_AT=${BUILD_DATE} \
LANG='en_US.UTF-8' \
LANGUAGE='en_US:en' \
LC_ALL='en_US.UTF-8' \
DISPLAY=:1 \
VNC_PORT=5901 \
NO_VNC_PORT=6901 \
HOME=/headless \
TERM=xterm \
STARTUPDIR=/dockerstartup \
INST_SCRIPTS=/headless/install \
NO_VNC_HOME=/headless/noVNC \
DEBIAN_FRONTEND=noninteractive \
VNC_COL_DEPTH=24 \
VNC_RESOLUTION=1280x1024 \
VNC_PW=vncpassword \
VNC_VIEW_ONLY=false \
IMG=taconsol/sakuli-base

EXPOSE $VNC_PORT $NO_VNC_PORT

WORKDIR $HOME

### Copy all install scripts for further steps
COPY ./src/common/install/ $INST_SCRIPTS/
RUN find $INST_SCRIPTS -name '*.sh' -exec chmod a+x {} +

### Install required packages and add configuration
RUN apt-get update && \
apt-get install -y \
wget \
locales \
gnome-calculator \
xfce4-screenshooter \
git \
nitrogen \
rsync \
libnss3-tools \
build-essential \
libxtst-dev \
net-tools \
python-numpy \
chromium-browser \
chromium-chromedriver \
chromium-browser-l10n \
chromium-codecs-ffmpeg \
firefox \
firefox-geckodriver \
openbox \
obconf \
obmenu \
xterm \
x11-xkb-utils \
libnss-wrapper \
gettext \
curl \
iputils-ping \
iputils-tracepath \
dnsutils && \
apt-get clean -y && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* && \
locale-gen en_US.UTF-8 && \
wget -qO- https://dl.bintray.com/tigervnc/stable/tigervnc-1.9.0.x86_64.tar.gz | tar xz --strip 1 --no-same-owner --no-same-permissions -C / && \
mkdir -p $NO_VNC_HOME/utils/websockify && \
wget -qO- https://github.com/novnc/noVNC/archive/v1.0.0.tar.gz | tar xz --strip 1 -C $NO_VNC_HOME && \
wget -qO- https://github.com/novnc/websockify/archive/v0.6.1.tar.gz | tar xz --strip 1 -C $NO_VNC_HOME/utils/websockify && \
chmod +x -v $NO_VNC_HOME/utils/*.sh && \
ln -s $NO_VNC_HOME/vnc_lite.html $NO_VNC_HOME/index.html && \
ln -s /usr/bin/chromium-browser /usr/bin/google-chrome && \
echo "CHROMIUM_FLAGS='--no-sandbox --user-data-dir'" > $HOME/.chromium-browser.init

COPY ./src/common/wm/ $HOME/
COPY ./src/common/config/openbox /etc/xdg/openbox
COPY ./src/common/config/vnc $HOME/.vnc

### Copy env scripts for startup
COPY ./src/common/env/ $STARTUPDIR/env

COPY ./src/common/firefox_profile/certificate-profile $HOME/firefox-certificates/
COPY ./src/common/chrome_certificate_store/ $HOME/.pki/

### configure startup
COPY ./src/common/scripts $STARTUPDIR
RUN $INST_SCRIPTS/set_user_permission.sh $STARTUPDIR $HOME

### configure startup
COPY ./src/common/scripts $STARTUPDIR
RUN $INST_SCRIPTS/set_user_permission.sh $STARTUPDIR $HOME

USER 1000:1000

### Install nvm
RUN $INST_SCRIPTS/nvm.sh $NODE_VERSION
21 changes: 9 additions & 12 deletions src/common/install/sakuli.sh → src/sakuli/sakuli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ set -e
echo "Reloading $HOME/.bashrc"
source $HOME/.bashrc

echo "nvm use $1"
nvm use $1

echo "//registry.npmjs.org/:_authToken=$3" > $HOME/.npmrc
echo "//registry.npmjs.org/:_authToken=$2" > $HOME/.npmrc
npm whoami

echo "Installing Sakuli v$2"
npm i -g -E @sakuli/cli@$2
echo "Installing Sakuli v$1"
npm i -g -E @sakuli/cli@$1

echo "Installing Sakuli legacy v$2"
npm i -g -E @sakuli/legacy@$2
echo "Installing Sakuli legacy v$1"
npm i -g -E @sakuli/legacy@$1

echo "Installing Sakuli legacy-types v$2"
npm i -g -E @sakuli/legacy-types@$2
echo "Installing Sakuli legacy-types v$1"
npm i -g -E @sakuli/legacy-types@$1

forwarders=("gearman" "checkmk" "icinga2" "prometheus")
for fwd in "${forwarders[@]}"
do
echo "Installing Sakuli forwarder $fwd v$2"
npm i -g -E @sakuli/forwarder-$fwd@$2
echo "Installing Sakuli forwarder $fwd v$1"
npm i -g -E @sakuli/forwarder-$fwd@$1
done

echo "Installing TypeScript v3.8.3"
Expand Down

0 comments on commit 373a28f

Please sign in to comment.