Created
February 26, 2019 12:24
-
-
Save jonasbg/c74632e6e806395be131406ec0dcacbb to your computer and use it in GitHub Desktop.
Dockerfile - Angular with ng serve
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.5' | |
services: | |
angular: | |
container_name: angular-container | |
build: | |
context: app | |
dockerfile: Dockerfile | |
volumes: | |
- './app:/usr/src/app' | |
- '/usr/src/app/node_modules' | |
ports: | |
- 4200:4200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# base image | |
FROM node:10.15.1 | |
# install chrome for protractor tests | |
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
RUN apt-get update && apt-get install -yq google-chrome-stable | |
RUN npm install -g npm | |
RUN npm install -g @angular/cli | |
# set working directory | |
WORKDIR /usr/src/app | |
# add `/usr/src/app/node_modules/.bin` to $PATH | |
ENV PATH /usr/src/app/node_modules/.bin:$PATH | |
# install and cache app dependencies | |
COPY package.json /usr/src/app/package.json | |
RUN npm install | |
CMD ng serve --host 0.0.0.0 --poll 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dockerfile for running
ng serve
inside a container.