I\'m trying to Dockerize my laravel app. The app is already built and in git, but I .gitignore my vendor folder. I\'ve added a Dockerfile, which looks like this:
<
You can also use the official dockerhub composer image.
This is an example of a multi-stage build with composer running first in a separate container. The resulting /app/vendor is copied to wherever you want in your final image.
FROM composer as builder
WORKDIR /app/
COPY composer.* ./
RUN composer install
...
FROM php:7.1-fpm-alpine
...
COPY --from=builder /app/vendor /var/www/vendor