I'm attempting to Dockerize a Laravel application. The app is already created and in git, but my vendor folder is.gitignored. I've added a Dockerfile with the following contents:
FROM php:7.1-fpm-alpine
RUN apk update && apk add curl && \
curl -sS https://getcomposer.org/installer | php \
&& chmod +x composer.phar && mv composer.phar /usr/local/bin/composer
RUN apk --no-cache add --virtual .build-deps $PHPIZE_DEPS \
&& apk --no-cache add --virtual .ext-deps libmcrypt-dev freetype-dev \
libjpeg-turbo-dev libpng-dev libxml2-dev msmtp bash openssl-dev pkgconfig \
&& docker-php-source extract \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ \
--with-png-dir=/usr/include/ \
--with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install gd mcrypt mysqli pdo pdo_mysql zip opcache \
&& pecl install mongodb redis xdebug \
&& docker-php-ext-enable mongodb \
&& docker-php-ext-enable redis \
&& docker-php-ext-enable xdebug \
&& docker-php-source delete \
&& apk del .build-deps
WORKDIR /var/www/html
COPY composer.json composer.lock ./
RUN composer install --no-scripts --no-autoloader
COPY . .
RUN chmod +x artisan
RUN composer dump-autoload --optimize && composer run-script post-install-cmd
CMD php artisan serve --host 0.0.0.0 --port 5001
This appears to function well when I'm building. In the output, I see the dependencies being downloaded and the autoload file being generated. However, once the build is finished, the vendor folder is missing. I'm presuming everything was done in a temporary container that was subsequently removed? So when I run docker-compose up, I get: Fatal error: require(): Failed opening required '/var/www/html/bootstrap/../vendor/autoload.php'
I looked at some other threads but wasn't able to find a suitable answer.