Skip to content

Commit

Permalink
add support for Chrone and JRE 8 (#25)
Browse files Browse the repository at this point in the history
Add support for Chrome browser and JRE 8 (Selenium)
  • Loading branch information
thescientist13 committed Jun 10, 2018
1 parent c2669ad commit f5f684e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:

- run:
name: Build the image
command: docker build -t nodejs-dev .
command: docker build -t nodejs-dev .
23 changes: 10 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y curl vim git bzip2 ssh
RUN apt-get update && apt-get install -y curl vim git bzip2 ssh

# install HeadlessChrome X11 packages
# https://github.com/Quramy/puppeteer-example#with-docker-based-ci-services
Expand All @@ -11,19 +10,17 @@ RUN apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 lib
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

# install NodeJS LTS
# install Chrome and Java JRE
# https://askubuntu.com/questions/510056/how-to-install-google-chrome
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | tee /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt-get install -y google-chrome-stable default-jre

# install NodeJS 8 LTS
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs

# install latest yarn@^1.0.0
# install latest yarn@1.0.0 and upgrade to latest release of npm@5.0.0
# use yarn to install npm \_(ツ)_/¯
# https://stackoverflow.com/questions/44269086/how-to-upgrade-npm-to-npm5-on-the-latest-node-docker-image
RUN npm install -g yarn@^1.0.0

# upgrade to latest release of npm@^5.0.0
RUN yarn global add npm@^5.0.0

# environment info
RUN node -v
RUN npm -v
RUN yarn -v
RUN npm install -g yarn@^1.0.0 && yarn global add npm@^5.0.0
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ A [Docker][] image for [NodeJS][] development, primarily for the benefit of The


## Features

### Environment
| Tool | Version | Notes |
|------|---------|-------|
| [NodeJS][] | 8.x | This is the current LTS version |
| [Yarn][] | 1.x | |
| [npm][] | 5.x | |
| [Chrome Headless][] | N / A | Base image accounts for needed host packages needed to run Chrome Headless |
| [Chrome Headless][] | N / A | Host packages needed to run **Chrome** Headless |
| [Chrome][] | Stable | Host packages needed to run **Chrome** browser (in headless mode) like **puppeteer** |
| [JRE][] | 8 | Java Runtime Environment (needed by **Selenium**) |

[NodeJS]: https://nodejs.org/en/download/
[npm]: https://www.npmjs.com/
[Yarn]: https://yarnpkg.com/en/
[Chrome Headless]: https://developers.google.com/web/updates/2017/04/headless-chrome
[Chrome]: https://www.google.com/chrome/
[JRE]: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

### Headless Chrome (Karma)
Include this in your _karma.conf.js_.
### Karma
[Karma](https://karma-runner.github.io/) can use HeadlessChrome by including this in _karma.conf.js_.

```javascript
browsers: ['CustomChromeHeadless'],
Expand All @@ -35,6 +41,32 @@ browserDisconnectTimeout: 210000,
browserNoActivityTimeout: 210000,
```

### Web Component Tester (Selenium)
[Web Component Tester](https://github.com/Polymer/tools/tree/master/packages/web-component-tester#custom-environments) can use Chrome by including this in _wct.conf.json_.

```javascript
{
"plugins": {
"local": {
"disabled": true
},
"headless": {
"browsers": [
"chrome"
],
"browsersOptions": {
"chrome": [
"window-size=1920,1080",
"headless",
"disable-gpu",
"no-sandbox"
]
}
}
}
}
```

## Development
Common Docker commands, generally used in development

Expand Down

0 comments on commit f5f684e

Please sign in to comment.