Sign inSign up

engdiegocouto/angular-cli

By engdiegocouto

Updated almost 7 years ago

A simple Docker Image to Angular CLI that you should use in development environment.

Image
1

206

engdiegocouto/angular-cli repository overview

docker-angular-cli

A simple Docker Image to Angular CLI that you should use in development environment.

GitHub forks GitHub stars

Table of contents

Building Image

First of all, you need clone this project from Git Hub.

$ git clone https://github.com/engdiegocouto/docker-angular-cli && cd docker-angular-cli

If you want to build an image with a specific version of the @angular/cli, then use the NG_VERSION build variable.

$ export NG_VERSION=8.3.20 && docker build . --build-arg NG_VERSION=$NG_VERSION -t angular-cli:$NG_VERSION

If you prefer the latest version, just execute:

$ docker build . -t angular-cli

Using from Docker Hub

Pull lastest version from Docker Hub:

$ docker pull engdiegocouto/angular-cli

Examples

Generate a project

We will create a project called myapp under $PWD directory, typing the follow command:

$ docker run --rm -u $(id -u):$(id -g) -v $PWD:/webapp -v $HOME/.npm:/.npm -v $HOME/.config:/.config engdiegocouto/angular-cli new myapp
Generate a component

Based on project created previously, so execute:

$ cd $HOME/myapp \
  && docker run --rm -u $(id -u):$(id -g) -v $PWD:/app engdiegocouto/angular-cli g c mycomponent
Run an existing project

Considering the scenario previously showed, you can run this command bellow.

$ docker run --rm -u $(id -u):$(id -g) -v $PWD:/app -p 4200:4200 engdiegocouto/angular-cli serve --host 0.0.0.0

If you prefer, use a solution based on docker-compose.yaml.

version: '3.7'
services:
    webapp:
        #image: engdiegocouto/angular-cli
        container_name: "mywebapp"
        image: angular-cli
        restart: always
        command: serve --host 0.0.0.0
        ports:
            - "4200:4200"
        volumes:
           - ./myapp:/webapp
        networks:
            - ng-network
networks:
    ng-network:

Tag summary

Content type

Image

Digest

Size

50.4 MB

Last updated

almost 7 years ago

docker pull engdiegocouto/angular-cli