Skip to content

tangtony/docker-angular-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Angular CLI

A Docker image for running Angular CLI in a container.

Benefits

  • Eliminate the need to manually confirm that you are running a version of Node.js/npm that is compatible with your version of Angular CLI.
  • Ensure that all developers are running the same version of the build tools.
  • Ensure that the build machine is running the same version of the build tools as the developers.
  • Make switching between projects with different versions of the build tools transparent to the developers.
  • Ensure that builds are reproducible.

Usage

One-Time Setup

  1. Create a new Angular CLI project:

    docker run -it --rm -v $(pwd):/code --entrypoint ng samherrmann/angular-cli new my-app
  2. Copy the npm.sh script into your project's root directory.

    • Change the latest version tag inside the npm.sh script to the actual version of the image (Ex: Replace latest with 1.6.2).
    • Commit it to your version control system.
  3. Add the following configuration to angular-cli.json to make the app accessible from the browser on the host machine:

      "defaults": {
        "serve": {
          "host": "0.0.0.0"
        }
      }
  4. Modify karma.conf.js to use headless Chrome:

    browsers: ['customChrome'],
    customLaunchers: {
      customChrome: {
        base: 'ChromiumHeadless',
        flags: ['--headless', '--no-sandbox']
      }
    }
  5. Modify protractor.conf.js to use headless Chrome:

    chromeDriver: '/usr/bin/chromedriver',
    capabilities: {
    'browserName': 'chrome',
      chromeOptions: {
        args: ['--headless', '--no-sandbox']
      }
    }
  6. Modify the e2e script in package.jsonto run e2e tests without updating drivers:

    "e2e": "ng e2e --webdriver-update=false",

Development Workflow

Execute Angular CLI commands:

./npm.sh run ng g m my-module
./npm.sh run ng g c my-module/my-component

Execute npm commands:

./npm.sh install <my-new-lib>
./npm.sh start
./npm.sh run lint
./npm.sh run test
./npm.sh run e2e

Development

Build Image

Run the ./build.sh script to build an image.

Publish Image

Run the ./publish.sh script to push an image to Docker Hub.

About

A Docker image for Angular CLI in a container

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 56.6%
  • Dockerfile 43.4%