Last active
September 6, 2022 04:27
-
-
Save kanthvallampati/d6b83be5d1f070e866e7517a2bfe0467 to your computer and use it in GitHub Desktop.
Sample Dockerfile to build and deploy an Angular app in Kubernetes
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
### STAGE 1: Build ### | |
FROM node:14.19.3 AS build | |
# Create app directory | |
WORKDIR /usr/src/app | |
# A wildcard is used to ensure both package.json AND package-lock.json are copied | |
COPY package*.json ./ | |
# Install app dependencies | |
RUN npm install --force --verbose | |
# Bundle app source | |
COPY . . | |
# Build prod | |
RUN $(npm bin)/ng build --prod | |
### STAGE 2: Run ### | |
# Prepare production environment | |
FROM nginx:latest | |
# Copy dist | |
COPY --from=build /usr/src/app/<dist-folder>/<app-name> /usr/share/nginx/html | |
COPY nginx.conf /etc/nginx/nginx.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment