我在docker中克隆了一个基于Yii2的项目来创建另一个具有相同架构的项目。
当我试用容器时,我对处方供应商有疑问。
php_1 | + gosu www-data composer config -g github-oauth.github.com <token>
php_1 | Cannot create cache directory /home/oldproject/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
php_1 | Cannot create cache directory /home/oldproject/.composer/cache/files/, or directory is not writable. Proceeding without cache
php_1 |
php_1 |
php_1 | [ErrorException]
php_1 | touch(): Unable to create file /home/oldproject/.composer/config.json because No such file or directory
当然会发生这种情况,因为我没有/home/oldproject/
这样的路径,但有/home/newproject/
我找不到哪里可以调整作曲家的缓存目录。另外一个不明白为什么作曲家尝试用旧名称触摸目录中的文件。
在Dockerfile中安装Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
卷在compose中挂载
volumes:
- ./app:/home/newproject/app
- ./docker/runtime/.config/composer:/home/newproject/.composer
- composer:/home/newproject/.composer