Skip to content

Instantly share code, notes, and snippets.

@andreasvirkus
Created March 10, 2019 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreasvirkus/a0a029e7ee40f8cf22d7c61d59853bc9 to your computer and use it in GitHub Desktop.
Save andreasvirkus/a0a029e7ee40f8cf22d7c61d59853bc9 to your computer and use it in GitHub Desktop.
Dockerfile for static SPAs
# 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