Created
November 26, 2019 17:17
-
-
Save paulredmond/06d9d08c3999236c66e89c2f7b3e5230 to your computer and use it in GitHub Desktop.
Example of a Laravel multi-stage build
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
FROM composer:1.7 as vendor | |
COPY database/ database/ | |
COPY composer.json composer.json | |
COPY composer.lock composer.lock | |
RUN composer install \ | |
--ignore-platform-reqs \ | |
--no-interaction \ | |
--no-plugins \ | |
--no-scripts \ | |
--prefer-dist | |
# | |
# Frontend | |
# | |
FROM node:8.11 as frontend | |
RUN mkdir -p /app/public | |
COPY package.json webpack.mix.js yarn.lock /app/ | |
COPY resources/assets/ /app/resources/assets/ | |
WORKDIR /app | |
RUN yarn install && yarn production | |
# | |
# Application | |
# | |
FROM php:7.2-apache-stretch | |
COPY . /var/www/html | |
COPY --from=vendor /app/vendor/ /var/www/html/vendor/ | |
COPY --from=frontend /app/public/js/ /var/www/html/public/js/ | |
COPY --from=frontend /app/public/css/ /var/www/html/public/css/ | |
COPY --from=frontend /app/mix-manifest.json /var/www/html/mix-manifest.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment