Dockerfile - Speed Up The Setting of Permissions
I am working on a few projects that have roughly 10,000 files, primarily because there is so much within the
/vendor directory that gets pulled down using composer.
This means that when I am setting the permissions as part of the docker build, it goes extremely slowly.
Luckily, there are some things you can do to speed things up.
COPYdocker command supports
--chownwhich removes the need to do this as a separate
COPY --chown=root:www-data source /var/www/my-site
If you are using composer to pull down PHP packages, make sure to use the
--no-devoption so you don't pull down files you don't need.
First published: 8th January 2019