A simple Docker Image to Angular CLI that you should use in development environment.
206
A simple Docker Image to Angular CLI that you should use in development environment.
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
Pull lastest version from Docker Hub:
$ docker pull engdiegocouto/angular-cli
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
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
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:
Content type
Image
Digest
Size
50.4 MB
Last updated
almost 7 years ago
docker pull engdiegocouto/angular-cli