php composer inside container lost vendor directory
I have the following Dockerfile
FROM bitgandtter/sf:php7 # basic env fix ENV TERM xterm # install packages ADD . /var/www # update dependencies RUN cd Helpers && SYMFONY_ENV=prod composer update -o --no-dev ENV SYMFONY_ENV prod
After build the image the Helpers directory does not contain the vendor directory.
I really dont know why is that since the previous compsoer update just execute successfully and the image was created just fine.
Any help please
NOTE: the image bitgandtter/sf:php7 use a VOLUME declaration on /var/www
One Solution collect form web for “php composer inside container lost vendor directory”
In fact i discover that the VOLUME declaration on the base image was the main issue.
As explained in the official doc after define a VOLUME on a dockerfile if any file changes happens inside that volume will be lost.
So the solution is to not declare VOLUMES on base images.