Skip to content

Instantly share code, notes, and snippets.

@jonasbg
Created February 26, 2019 12:24
Show Gist options
  • Save jonasbg/c74632e6e806395be131406ec0dcacbb to your computer and use it in GitHub Desktop.
Save jonasbg/c74632e6e806395be131406ec0dcacbb to your computer and use it in GitHub Desktop.
Dockerfile - Angular with ng serve
node_modules
.git
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
# 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
@jonasbg
Copy link
Author

jonasbg commented Feb 26, 2019

Dockerfile for running ng serve inside a container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment