Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update ubuntu jvm and npm [CC-10566] #12

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
251782e
moving to ubuntu xenial to fix issues
Aug 8, 2017
83963a3
Added firefox to image
Aug 8, 2017
f506b7e
Added firefox to image (readme)
Aug 8, 2017
7b80b3c
changed to work with latest protractor
Aug 9, 2017
7096dfe
changed to manual mode only
Aug 9, 2017
d40f7ed
stripped out autorunning of protractor
Aug 14, 2017
c41d34b
unfoobarred the readme formatting
Aug 14, 2017
96c68f9
fixing version of chrome driver
Dec 15, 2017
f101aa4
fixing version of chrome driver
Dec 15, 2017
a821ad8
fixing npm version at 5.5.1
Dec 15, 2017
3e80ba3
attempting to fix it again..
Dec 15, 2017
78e5d0c
fixing... again
Dec 17, 2017
db98f9a
May have finally fixed it
Dec 17, 2017
37531c1
upgrading node to 8.x
mbcx4jrh Apr 26, 2018
cb8b8e0
adding locales and setting en_GB
mbcx4jrh Apr 27, 2018
bc05d16
Updating readme to add llocales
mbcx4jrh Apr 27, 2018
f82b4bd
install git
KimStebel May 24, 2018
58baadd
Move the furniture about. Install GCloud SDK.
hirez Feb 22, 2019
6221e30
Bother
hirez Feb 22, 2019
c40fbf2
Bother again
hirez Feb 22, 2019
3dae9c7
Merge pull request #1 from flexys/hack_in_gcloud_sdk
KimStebel Feb 25, 2019
db0ed7f
Muppet, Julia.
hirez Feb 26, 2019
5262174
Merge pull request #2 from flexys/oh_jq
hirez Feb 26, 2019
60d0898
Add web driver as parameter
Sep 18, 2019
8027651
Fix webdriver file
Sep 18, 2019
73ec323
Remove no longer needed bits to run ats
sergiojoker11 Sep 25, 2020
dddb7c8
Merge pull request #3 from flexys/task/run-ats-directly-without-selenium
sergiojoker11 Sep 25, 2020
f66df7a
Install node using apt-get instead
sergiojoker11 Sep 25, 2020
45ab690
Install node using the script from official source and then apt-get
sergiojoker11 Sep 25, 2020
a9ceff2
Explicitly install supervisor
Sep 25, 2020
8c59eb0
Merge pull request #6 from flexys/more_hackery
hirez Sep 25, 2020
2ef87a4
Revert "Explicitly install supervisor"
sergiojoker11 Sep 26, 2020
29043b2
Revert "Install node using the script from official source and then a…
sergiojoker11 Sep 26, 2020
890a364
Revert "Install node using apt-get instead"
sergiojoker11 Sep 26, 2020
a9cf1af
Revert "Remove no longer needed bits to run ats"
sergiojoker11 Sep 26, 2020
279a54c
Update the base image, jvm and node versions
bmjsmith Oct 15, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 31 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
FROM debian:testing
FROM ubuntu:focal

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && \
apt-get install -y curl && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# ffmpeg is hosted at deb-multimedia.org
RUN curl http://www.deb-multimedia.org/pool/main/d/deb-multimedia-keyring/deb-multimedia-keyring_2016.8.1_all.deb \
-o /tmp/deb-multimedia-keyring.deb && \
dpkg -i /tmp/deb-multimedia-keyring.deb && \
rm /tmp/deb-multimedia-keyring.deb && \
echo "deb http://www.deb-multimedia.org stretch main non-free" >> /etc/apt/sources.list

RUN apt-get update && \

RUN apt-get update --fix-missing && \
apt-get install -y \
openjdk-8-jre \
git \
apt-utils \
wget \
curl \
build-essential \
libssl-dev \
openjdk-11-jre \
xvfb \
libgconf-2-4 \
libexif12 \
chromium \
npm \
firefox \
supervisor \
netcat-traditional \
curl \
ffmpeg && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
jq \
ffmpeg

RUN echo "deb http://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

RUN ln -s /usr/bin/nodejs /usr/bin/node
# Set the locale (dates may be borked in protractor if not)
RUN apt-get update && apt-get install -y locales locales-all
RUN locale-gen en_GB.UTF-8
ENV LANG en_GB.UTF-8
ENV LANGUAGE en_GB:en
ENV LC_ALL en_GB.UTF-8

# Upgrade NPM to latest (address issue #3)
RUN npm install -g npm

# Install Protractor
RUN npm install -g [email protected]
RUN apt-get install -y google-cloud-sdk

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get update --fix-missing && \
apt-get install -y nodejs chromium-browser

RUN npm install -g protractor

RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Selenium and Chrome driver
RUN webdriver-manager update
Expand All @@ -50,11 +55,6 @@ ADD supervisor.conf /etc/supervisor/supervisor.conf
# Add service defintions for Xvfb, Selenium and Protractor runner
ADD supervisord/*.conf /etc/supervisor/conf.d/

# By default, tests in /data directory will be executed once and then the container
# will quit. When MANUAL envorinment variable is set when starting the container,
# tests will NOT be executed and Xvfb and Selenium will keep running.
ADD bin/run-protractor /usr/local/bin/run-protractor

# Container's entry point, executing supervisord in the foreground
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisor.conf"]

Expand Down
24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,25 @@ Dockerfile for [Protractor](http://angular.github.io/protractor/) test execution

Based on [caltha/protractor](https://bitbucket.org/rkrzewski/dockerfile), this image contains a fully configured environment for running Protractor tests under the Chromium browser.

This version additionally supports linking docker containers together to test software in another container, and passing a custom base URL into your protractor specs so you don't have to hard-code the URL in them.
This version additionally supports linking docker containers together to test software in another container, and passing a custom base URL into your protractor specs so you don't have to hard-code the URL in them.

Installed software
------------------
* [locales][http://jaredmarkell.com/docker-and-locales/] This image is configures to en_GB as this is where we test.
* [Xvfb](http://unixhelp.ed.ac.uk/CGI/man-cgi?Xvfb+1) The headless X server, for running browsers inside Docker
* [node.js](http://nodejs.org/) The runtime platform for running JavaScript on the server side, including Protractor tests
* [npm](https://www.npmjs.com/) Node.js package manager used to install Protractor and any specific node.js modules the tests may need
* [Selenium webdriver](http://docs.seleniumhq.org/docs/03_webdriver.jsp) Browser instrumentation agent used by Protractor to execute the tests
* [OpenJDK 8 JRE](http://openjdk.java.net/projects/jdk8/) Needed by Selenium
* [Chromium](http://www.chromium.org/Home) The OSS core part of Google Chrome browser
* [Firefox](https://www.mozilla.org) Firefox browser
* [Protractor](http://angular.github.io/protractor/) An end-to-end test framework for web applications
* [Supervisor](http://supervisord.org/) Process controll system used to manage Xvfb and Selenium background processes needed by Protractor

Running
-------
In order to run tests from a CI system, execute the following:
```
docker run --rm -v <test project location>:/project mrsheepuk/protractor
```
The container will terminate automatically after the tests are completed.

To run against another container, execute as follows (this example assumes that the image you are testing exposes its web site on port 3000):
```
docker run -d --name=webe2e <image to test>
docker run --rm --link=webe2e:webe2e -v <test project location>:/project --env BASEURL=http://webe2e:3000/ mrsheepuk/protractor
docker rm -f webe2e
```

You can also use the BASEURL variable without container linking, to test any arbitrary web site. If you wish to use the BASEURL functionality, you must use relative URLs within your test specs (e.g. `browser.get("/profile/")` instead of `browser.get("http://test.com/profile/")`.
I have stripped out the automatic running of protractor as we inject the tests through [Concourse](http://concourse.ci)

If you want to run the tests interactively you can launch the container and enter into it:
```
CONTAINER=$(docker run -d -v <test project location>:/project --env MANUAL=yes mrsheepuk/protractor)
docker exec -ti $CONTAINER sudo -i -u node bash
```
When inside the container you can run the tests at the console by simply invoking `protractor`. When you are done, you terminate the Protractor container with `docker kill $CONTAINER`.

Your protractor.conf.js must specify the no-sandbox option for Chrome to cleanly run inside Docker. A minimal example config would be:
Expand Down
36 changes: 0 additions & 36 deletions bin/run-protractor

This file was deleted.

15 changes: 0 additions & 15 deletions supervisord/protractor.conf

This file was deleted.

2 changes: 1 addition & 1 deletion supervisord/webdriver.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Run browsers on dispaly :1 provided by Xvfb
environment = DISPLAY=":1.0"

command = webdriver-manager start
command = webdriver-manager start --versions.chrome=%(ENV_WEBDRIVER_VERSION)s

stdout_logfile = /var/log/supervisor/%(program_name)s-out.log
stderr_logfile = /var/log/supervisor/%(program_name)s-err.log