Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save matthewlilley/88eb596aa0f1e275ac2bcea66a26aae5 to your computer and use it in GitHub Desktop.
Save matthewlilley/88eb596aa0f1e275ac2bcea66a26aae5 to your computer and use it in GitHub Desktop.
Build kit
# Defining environment
ARG APP_ENV=development
# Building the base image
FROM node:lts-alpine as base
RUN echo "running BASE commands"
# Building the preinstall production image
FROM base as production-preinstall
RUN echo "running production preinstall commands"
# Building the development image
FROM base as development-preinstall
RUN echo "running development preinstall commands"
# Installing the app files
FROM ${APP_ENV}-preinstall as install
RUN echo "running install commands"
RUN npm install
FROM install as production-postinstall
RUN echo "running production postinstall commands"
RUN npm prune
FROM install as development-postinstall
RUN echo "running production postinstall commands"
FROM ${APP_ENV}-postinstall as final
RUN echo "running final commands"
CMD ["/bin/sh", "/app/scripts/run.sh"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment