Created
April 9, 2020 14:59
-
-
Save zanematthew/d5a64bbc3895da6aed889ad3ad74d28a to your computer and use it in GitHub Desktop.
NGINX Dockerfile
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
ARG NODE_VERSION=node:8.11 | |
ARG WEB_ROOT | |
FROM $NODE_VERSION as dev_frontend_assets | |
RUN mkdir -p /app/public | |
COPY /src /app | |
WORKDIR /app | |
RUN npm install && npm run development | |
FROM nginx as frontend_dev | |
ARG WEB_ROOT | |
COPY /src $WEB_ROOT | |
COPY /services/nginx/default.conf /etc/nginx/conf.d/default.conf | |
COPY --from=dev_frontend_assets /app/public/js/ $WEB_ROOT/public/js/ | |
COPY --from=dev_frontend_assets /app/public/css/ $WEB_ROOT/public/css/ | |
### | |
# | |
# Production Front-end | |
# Application dependencies | |
FROM $NODE_VERSION as prod_frontend_assets | |
RUN mkdir -p /app/public | |
COPY /src/package.json \ | |
/src/package-lock.json \ | |
/src/webpack.mix.js \ | |
/app/ | |
COPY /src/resources/assets/js/ /app/resources/assets/js/ | |
COPY /src/resources/assets/sass/ /app/resources/assets/sass/ | |
WORKDIR /app | |
RUN npm install && npm run production | |
FROM nginx as frontend_prod | |
ARG WEB_ROOT | |
COPY /src $WEB_ROOT | |
COPY /services/nginx/default.conf /etc/nginx/conf.d/default.conf | |
COPY --from=prod_frontend_assets /app/public/js/ $WEB_ROOT/public/js/ | |
COPY --from=prod_frontend_assets /app/public/css/ $WEB_ROOT/public/css/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment