Skip to content

Instantly share code, notes, and snippets.

@sefatanam
Last active August 19, 2021 11:51
Show Gist options
  • Save sefatanam/cf50a3a60f5352521668c21c12741574 to your computer and use it in GitHub Desktop.
Save sefatanam/cf50a3a60f5352521668c21c12741574 to your computer and use it in GitHub Desktop.
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
# 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
COPY ./nginx/gzip.conf /etc/nginx/gzip.conf
ENTRYPOINT ["nginx", "-g", "daemon off;"]
@sefatanam
Copy link
Author

generate package-lock.json => npm install --package-lock

@sefatanam
Copy link
Author

sefatanam commented Aug 19, 2021

Angular v12 Update


# STEP 1 : build-stage
FROM node:14.16.0-alpine3.13 as build-stage

WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
RUN npm run build

# STEP 2 : Production
FROM nginx:1.12-alpine
# RUN addgroup app && adduser -S -G app app
# USER app
COPY --from=build-stage /app/dist/APP_NAME /usr/share/nginx/html
EXPOSE 80
ENTRYPOINT [ "nginx","-g","daemon off;" ]

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