Last active
January 22, 2019 16:56
-
-
Save alex-arriaga/c821da19ff05d775906c23fc0496e887 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# === Start: Stage #1 - Building the web app | |
FROM node:10.15.0-alpine AS builder | |
WORKDIR /usr/app | |
# Wildcard to copy package-lock.json too | |
COPY package*.json ./ | |
# RUN executes command(s) in a new layer and creates a new image. E.g., it is often used for installing software packages. | |
RUN npm install | |
# Copy only the required files/folders ordered from least o most subject to change | |
# That way the built will only run if any of these files/folders are modified | |
COPY angular.json . | |
COPY tsconfig.json . | |
COPY tslint.json . | |
COPY e2e e2e | |
COPY src src | |
RUN npm run-script build -- --prod | |
# This is just for testing the app was built correctly | |
# && ls -la /usr/app | |
# === End: Stage #1 | |
# === Start: Stage #2 - Configuring Nginx with the app as document's root | |
FROM nginx:1.15.5-alpine | |
COPY docker/nginx/nginx.conf /etc/nginx/nginx.conf | |
# TODO: Change "my-app" in "/usr/app/dist/my-app" for the name of your application, | |
# for example: "/usr/app/dist/my-angular-application" | |
COPY --from=builder /usr/app/dist/my-app /usr/share/nginx/html/ | |
# This is just for testing the app was copied correctly | |
# RUN ls -la /usr/share/nginx/html/ | |
EXPOSE 80 | |
# ENTRYPOINT configures a container that will run as an executable. | |
ENTRYPOINT ["/bin/ash", "-c", "nginx -g 'daemon off;'"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.