Skip to content

Instantly share code, notes, and snippets.

@exah
Last active November 18, 2017 10:23
Show Gist options
  • Save exah/e5de1a65bb6f2567ce430bc47b2a1c40 to your computer and use it in GitHub Desktop.
Save exah/e5de1a65bb6f2567ce430bc47b2a1c40 to your computer and use it in GitHub Desktop.
Slim Multi-Stage JS App Image
# Base
FROM node:8-alpine AS base
ENV APP_DIR /app/
ENV NODE_ENV production
WORKDIR $APP_DIR
ADD package.json yarn.lock $APP_DIR
RUN yarn
CMD []
# Install dev deps & build app
FROM base AS build
ADD . $APP_DIR
RUN yarn --production=false
RUN npm run build
# Create production image
FROM base AS release
LABEL name="{{ APP_NAME }}"
COPY --from=build $APP_DIR/dist ./dist
ADD . $APP_DIR
CMD npm start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment