Dockerfile created for Angular application continuous integration.
It contains Node + Chromium + JRE 8 and npm run
command like Entrypoint.
-
Create a container to this image with command to run in your
package.json
:# Container name: ci-build # Script in package.json: build:ci docker create --name ci-build guieb/node-chromium-jre8 build:ci
-
Copy your source code to this container (put in
/sources
):# Source code: . (current directory in bash) # <Container name>/sources: ci-build:/sources docker cp . ci-build:/sources
-
Start the container:
# Container name: ci-build # -a: Attach STDOUT/STDERR and forward signals sudo docker start ci-build -a
It's necessary ChromeHeadless
and --no-sandbox
:
// karma.conf.js
...,
browsers: ['ChromeHeadlessNoSandbox'],
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
}
},
...
It's necessary:
- Change the chrome driver location
- Set
--headless
,--disable-gpu
and--no-sandbox
// protractor.conf.js
...,
chromeDriver: '/usr/bin/chromedriver',
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [
'--headless',
'--disable-gpu',
'--no-sandbox'
]
}
},
...