1、在 jenkins 中构建镜像时,报错:fatal: Could not read from remote repository.。虽然 Packagist 镜像地址已经切换为阿里云:https://mirrors.aliyun.com/composer/ 。查看 Dockerfile。如图1
RUN chown -R nginx:nginx /mcloud/www/ && / rm -rf /etc/nginx/conf.d/status.conf && / chmod +x /usr/local/bin/composer && / composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ && / cd /mcloud/www/cmcp-api && / composer install
2、最终决定将 /vendor 目录添加至 Git 仓库:# /vendor,编辑 .gitignore
# Env /.env # Composer # /vendor composer.phar # JS node_modules spa/npm-debug.log spa/yarn-error.log # IDE .idea nbproject .buildpath .project .settings # windows thumbnail cache Thumbs.db # Mac DS_Store Files .DS_Store # phpunit phpunit.phar /phpunit.xml # Vagrant /.vagrant # Tests tests/codeception/*/_support/_generated/*
3、编辑 Dockerfile,删除与 composer 相关的 4 行命令。构建成功。如图3
RUN chown -R nginx:nginx /mcloud/www/ && / rm -rf /etc/nginx/conf.d/status.conf
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/181545.html