Created
March 10, 2019 11:30
-
-
Save andreasvirkus/a0a029e7ee40f8cf22d7c61d59853bc9 to your computer and use it in GitHub Desktop.
Dockerfile for static SPAs
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
# build stage | |
FROM node:lts-alpine as build-stage | |
WORKDIR /app | |
# Install git (required for @qualitista/i18n package) | |
RUN apk update && \ | |
apk upgrade && \ | |
apk add git | |
COPY package*.json ./ | |
RUN CYPRESS_INSTALL_BINARY=0 npm ci && npm update @qualitista/i18n | |
COPY . . | |
RUN npm run build | |
# production stage | |
FROM nginx:stable-alpine as production-stage | |
COPY --from=build-stage /app/dist /usr/share/nginx/html | |
# TODO: Copy nginx config for security headers, gzip, etc. | |
EXPOSE 80 | |
CMD ["nginx", "-g", "daemon off;"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment