[英]how to do composer install during docker build
After deploying the application to laravel, I need to run these commands.将应用程序部署到 laravel 后,我需要运行这些命令。
docker exec -it php bash
composer update --ignore-platform-reqs
exit
cd back/src
sudo chmod o+w ./storage/ -R
But when deploying to other developers, this is inconvenient, how can I include these commands in a dockerfile or docker-compose.yml?但是当部署给其他开发人员时,这很不方便,我如何将这些命令包含在 dockerfile 或 docker-compose.yml 中? And even, it is possible that after build, docker-composer up -d is immediately filled甚至,有可能在构建之后, docker-composer up -d 立即被填充
Composer does not start from the system(root), so i have to run it from another container Composer 不是从系统(根)启动,所以我必须从另一个容器运行它
In the docker-compose.yml file you can set the command to update the packakges.在 docker-compose.yml 文件中,您可以设置更新包的命令。 Also set the volume, which will give the correct rights.还要设置音量,这将赋予正确的权限。
php:
command:
- composer update --ignore-platform-reqs
volumes:
- ./storage/:/app/storage:rw
But all of this does depend on the image you're using.但这一切都取决于您使用的图像。 Which docker image do you use?您使用哪个 docker 图像?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.