Skip to content

Instantly share code, notes, and snippets.

@KartikeyMish
Last active August 31, 2023 12:26
Show Gist options
  • Save KartikeyMish/a7965d3b906e0b2e272318f43a2b734f to your computer and use it in GitHub Desktop.
Save KartikeyMish/a7965d3b906e0b2e272318f43a2b734f to your computer and use it in GitHub Desktop.
Dockerfile template for angular projects
# angular version = 16
# Get your appname from the package-lock.json file of you angular project
# Stage 1
FROM node:latest as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build --prod
# Stage 2
FROM nginx:alpine
COPY --from=node /app/dist/{app-name} /usr/share/nginx/html
@KartikeyMish
Copy link
Author

In case you want to run docker via terminal instead of VS code extension, here's the terminal code

  1. Build the image
docker build --pull --rm -f "Dockerfile" -t image-name:latest "."
  1. Run image
docker run --rm -d -p 80:80/tcp image-name:latest 

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