Skip to content

Instantly share code, notes, and snippets.

@asanchezr
Created June 26, 2018 20:56
Show Gist options
  • Save asanchezr/df9463df44d8b308d5bd347cf0826204 to your computer and use it in GitHub Desktop.
Save asanchezr/df9463df44d8b308d5bd347cf0826204 to your computer and use it in GitHub Desktop.
Dockerfile that builds Angular app from source, then hosts the minified code on Ngnix container
FROM node:8.6 as builder

WORKDIR /home/node/angular-seed

# copy all files not listed in .dockerignore
COPY . .

# before switching to non-root user, change ownership of home
RUN chown -R node:node .
USER node

RUN npm install
RUN npm run build.prod

FROM nginx:1.13
COPY --from=builder /home/node/angular-seed/dist/prod /var/www/dist/prod
COPY ./.docker/nginx.conf /etc/nginx/conf.d/angular-seed.template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment