Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Peter Fejes committed Jan 23, 2018
0 parents commit eb7cda8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:latest

RUN apt-get update && \
apt-get install -y sudo default-jre xvfb chromium

ADD xvfb-chromium /root/xvfb-chromium

RUN chmod +x /root/xvfb-chromium

RUN mv /root/xvfb-chromium /usr/bin/xvfb-chromium

RUN ln -s /usr/bin/xvfb-chromium /usr/bin/google-chrome && \
ln -s /usr/bin/xvfb-chromium /usr/bin/chromium-browser

RUN chmod +x /usr/bin/google-chrome && \
chmod +x /usr/bin/chromium-browser

# Startup and shutdown chrome to set up an initial user-data-dir
RUN google-chrome --user-data-dir=/root/chrome-user-data-dir & \
(sleep 5 && sudo kill $(pgrep -o chromium) && sleep 2)

ENV CHROME_BIN /usr/bin/google-chrome

RUN node -p process.versions

RUN npm -v

ENTRYPOINT ["npm"]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Angular-testing
A simple docker container that can be used to unit and e2e test Angular applications. You can find this on docker hub as `markpeterfejes/angular-testing`
15 changes: 15 additions & 0 deletions xvfb-chromium
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

_kill_procs() {
kill -TERM $chromium
wait $chromium
}

# Setup a trap to catch SIGTERM and relay it to child processes
trap _kill_procs SIGTERM

# Start Chrome inside xvfb
xvfb-run -a -s "-screen 0 1920x1080x24 -nolisten tcp" chromium --no-sandbox $@ &
chromium=$!

wait $chromium

0 comments on commit eb7cda8

Please sign in to comment.