Skip to content

Instantly share code, notes, and snippets.

@dlrandy
Forked from changhuixu/Dockerfile
Created June 10, 2020 15:18
Show Gist options
  • Save dlrandy/b3e3b8246f2337352f1f34b76e802e64 to your computer and use it in GitHub Desktop.
Save dlrandy/b3e3b8246f2337352f1f34b76e802e64 to your computer and use it in GitHub Desktop.

Revisions

  1. @changhuixu changhuixu revised this gist May 10, 2020. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Dockerfile
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,5 @@ RUN rm -rf /usr/share/nginx/html/*
    COPY --from=builder /dist /usr/share/nginx/html

    COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
    EXPOSE 4200 80

    ENTRYPOINT ["nginx", "-g", "daemon off;"]
  2. @changhuixu changhuixu created this gist May 10, 2020.
    22 changes: 22 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    # 1. Build our Angular app
    FROM node:alpine as builder

    WORKDIR /app
    COPY package.json package-lock.json ./
    ENV CI=1
    RUN npm ci

    COPY . .
    RUN npm run build -- --prod --output-path=/dist

    # 2. Deploy our Angular app to NGINX
    FROM nginx:alpine

    ## Replace the default nginx index page with our Angular app
    RUN rm -rf /usr/share/nginx/html/*
    COPY --from=builder /dist /usr/share/nginx/html

    COPY ./.nginx/nginx.conf /etc/nginx/nginx.conf
    EXPOSE 4200 80

    ENTRYPOINT ["nginx", "-g", "daemon off;"]