nexus 社區也提供了php composer 私服(當前還在開發中,尚未ga),測試使用構建好的docker 鏡像php
version: "3"
services:
nexus:
image: jbuncle/nexus-repository-composer:2.0.0
volumes:
- "./nexus-data:/nexus-data"
ports:
- "8081:8081"
docker-compose up -d
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'a5c698ffe4b8e849a443b120cd5ba38043260d5c4023dbf93e1558871f1f07f58274fc6f4c93bcfd858c6bd0775cd8d1') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
{
"config": {
"secure-http": false
},
"require": {
"monolog/monolog": "1.0.*"
},
"repositories": {
"packagist": {
"type": "composer",
"url": "http://localhost:8081/repository/demo/"
}
}
}
composer install
nexus local cachedocker
在測試proxy 阿里雲,華爲雲以及幾個國內鏡像發現沒有成功 ,可是直接代理官方的沒有問題json
https://hub.docker.com/r/jbuncle/nexus-repository-composer
https://pkg.phpcomposer.com/
https://getcomposer.org/doc/06-config.md#secure-http
https://packagist.org/mirrorscomposer