Skip to content

Instantly share code, notes, and snippets.

@smaillns
Created January 8, 2022 15:42
Show Gist options
  • Save smaillns/557ce25dd8797d468bd5d130c5badc77 to your computer and use it in GitHub Desktop.
Save smaillns/557ce25dd8797d468bd5d130c5badc77 to your computer and use it in GitHub Desktop.
# Build the app
FROM node:12-alpine as build
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
RUN npm install -g @angular/cli
RUN ng build --prod --output-path=/dist
# Run in NGINX
FROM nginx:alpine
COPY --from=build /dist /usr/share/nginx/html
# When the container starts, replace the env.js with values from environment variables
CMD ["/bin/sh", "-c", "envsubst < /usr/share/nginx/html/assets/env.template.js > /usr/share/nginx/html/assets/env.js && exec nginx -g 'daemon off;'"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment