From node with angular-cli preinstalled for building angular project
355
Angular CLI with Docker
Node version manager, npm global, yarn global polute your HOME folder.
Docker solve
make, docker and docker-compose preinstalled
curl -o- -L https://raw.githubusercontent.com/sandangel/angular-cli-docker/master/install.sh | bash
"start": "ng serve -host 0.0.0.0"
# ng new ...(run fast with yarn will install all dependencies)
make new myWife
# yarn start. You have to move downloaded files to new created project.
mv Makefile docker-compose.yml myWife && cd myWife
# include at start script "ng serve -host 0.0.0.0" then run
make # or make start
# more commands
# yarn init
make init
# yarn install all dependencies
make install
# yarn add @angular/material as dependencies
make add @angular/material
# yarn add -D @types/node as develop dependency
make add-dev @types/node
# ng generate component ...
make g-c SignUpComponent
# ng generate service ...
make g-s HttpService
# clean up container
make clean
You can config Makefile for more angular-cli commands.
But you have to give your own permission for files, directories created inside container. So with commands that generate file or folder like "ng generate component ...", you have to specify like this:
g-c:
@docker-compose run --rm angular sh -c "ng g c $(ARGS) && $(PERM)"
With $(PERM) is a command that give file permission back to you.
$(ARGS) is command line argument after targets like "make g-c ...", "make add ..."
This image only expose PORT 4200 as default of webpack, but you are free to run on any port by config docker-compose.yml -port or use your own image.
This makes your computer more clean, do not need to install nodejs, yarn, angular-cli..., and do not need to add more $PATH.
Good luck and have funs with your angular project.
Content type
Image
Digest
Size
405.9 MB
Last updated
about 9 years ago
docker pull sandangel/angular-cli-docker