Sign inSign up

juanje/angular-cli-chrome

By juanje

•Updated almost 7 years ago

Angular CLI image for testing purposes.

Image
0

652

juanje/angular-cli-chrome repository overview

⁠Angular CLI testing container

This is a minimal image with Node.js, Angular CLI and Chrome Headless for testing. This image is based on juanje/angular-cli⁠, but it's a bit bigger, because of the Chrome and its dependencies. For normal dev workflow, better use the juanje/angular-cli one. This one it just for testing with Chrome Headless. It can be used locally or at some CI server.

⁠Important

This image is very opinionated about the user and group ID. I made this for my teammates at Edosoft⁠ and at our workstations the user has UID=1001 and GUID=1001, so that is what I used. But you can rebuild the image using your UID and GUI.

⁠Dockerfile

Here you have the used Dockerfile: Dockerfile.with_chrome⁠

You can build your own image by running this command:

$ docker build . -f Dockerfile.with_chrome -t your_image_name

You can customize some options, like the UID and GUID, by passing them as --build-arg :

$  docker build --build-arg UID=1000  --build-arg GUID=1000 . -f Dockerfile.with_chrome -t your_image_name

This is useful if your normal user has another UID and GUID.

⁠Karma configuration

To avoid errors with Karma.js⁠, be sure that you have this is your config file (karma.conf.js):

    browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
        ChromeHeadlessNoSandbox: {
            base: 'ChromeHeadless',
            flags: [
                "--no-sandbox",
                "--disable-web-security",
                "--disable-gpu",
                "--remote-debugging-port=9222"
            ]
        }
    },

⁠Software versions

  • Docker image base: node:13.2.0-alpine
  • Node.js: 13.2.0
  • Angular: 8.2.14
  • Angular CLI: 8.3.20

⁠Testing with the image

You can run the tests from your Angular project running this command: $ docker run -it --rm -v ${PWD}:/app juanje/angular-cli-chrome test --no-watch --no-progress

You can also use docker-compose. You can use this example:

version: '3'

services:
  test:
    image: juanje/angular-cli-chrome
    container_name: angular-cli-testing
    volumes:
      - '.:/app'
    entrypoint: 'ng test --no-watch --no-progress'

Now you can run:

$ docker-compose up

Tag summary

Content type

Image

Digest

Size

172.3 MB

Last updated

almost 7 years ago

docker pull juanje/angular-cli-chrome