Angular-cli in docker

Docker file

FROM ubuntu:16.04

MAINTAINER szalek <szalek@btbw.pl>

RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get install -y vim && \
    apt-get install -y curl && \
    apt-get install -y sudo && \
    echo "alias ll='ls -l'" >> /etc/bash.bashrc

RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && \
    apt-get install -y nodejs

RUN npm install -g @angular/cli

RUN useradd -ms /bin/bash szalek

EXPOSE 4200

in this docker image I have assumption that on the host machine we have user “szalek”

Build

docker build -t szalek/angular-cli .

Run

docker run -it -p 4200:4200 -u szalek:szalek -v /home/szalek/Workspace/DockerBridge:/home/szalek szalek/angular-cli

Run (#update)

docker run -it -p 4200:4200 -u szalek:szalek -v /home/szalek/Workspace/Angular:/home/szalek/Workspace szalek/angular-cli

in this way .npm mess exist only in docker

NG

- ng new {PROJECT_NAME}
- cd {PROJECT_NAME}
- ng serve --watch true --poll 100 --host 0.0.0.0 --port 4200 -o