Bina gudang kod intranet komposer
Tarik imej komposer/satis
docker pull composer/satis
Salin selepas log masuk
Konfigurasikan komposer
Langkah ini boleh dilangkau
Struktur direktori
├── auth.json ├── cache │ ├── files │ ├── repo │ └── vcs ├── composer.json └── config.json
Salin selepas log masuk
composer.json
{ }
Salin selepas log masuk
config.json
{ "config": { "secure-http": false, "optimize-autoloader": false, "preferred-install": "dist", "sort-packages": true, "platform": { } }, "repositories": { "packagist": { "type": "composer", "url": "https://mirrors.aliyun.com/composer/" } } }
Salin selepas log masuk
Membina sambungan modul
Struktur direktori
├── config.json ├── public │ ├── dist │ │ ├── bpc │ │ └── zhanghuizong │ ├── include │ │ └── all$f3811758e4611a4dfc1a96f4d1c06da09cdbe199.json │ ├── index.html │ └── packages.json └── satis.sh
Salin selepas log masuk
config.json
{ "name": "composer_satis_test", "homepage": "http://local.satis.com", "repositories": [ { "type": "git", "name": "zhanghuizong/composer_satis_test", "url": "https://gitee.com/zhanghuizong/composer_satis_test.git" } ], "require": { "zhanghuizong/composer_satis_test": "*" }, "archive": { "directory": "dist", "format": "tar", "skip-dev": true, "prefix-url": "http://local.satis.com" } }
Salin selepas log masuk
关键词 | 描述 |
---|---|
repositories | 指定去哪获取包 |
require | 指定获取哪些包,如果想获取所有包,使用require-all: true |
archive.directory | output-dir 即使build的输出目录 |
archive.format | 可选,默认:zip, 支持两种压缩格式:zip,tar。build时采用的压缩格式 |
archive.skip-dev | 可选,默认情况下为false,启用时(true)satis不会为分支机构创建下载 |
archive.prefix-url | 可选的下载位置,主页(来自satis.json),默认情况下是目录 |
Penerangan laman web rasmi: https://docs.phpcomposer.com/articles/handling-private-packages -dengan -satis.html
Kod GitHub: https://github.com/composer/satis
skrip shell
satis.sh
#!/usr/bin/env bash docker run --rm --init -it -v "$(pwd)"/config.json:/satis.json:ro \ -v "$(pwd)"/public/:/build \ -v /mnt/d/workspaces/docker-config/composer/:/composer \ composer/satis build /satis.json /build "$@"
Salin selepas log masuk
Tambah akses pantas
Edit fail: vi ~/.bashrc
alias satis='docker run --rm --init -it -v "$(pwd)"/config.json:/satis.json:ro -v "$(pwd)"/public/:/build -v /mnt/d/workspaces/docker-config/composer/:/composer composer/satis build /satis.json /build'
Salin selepas log masuk
Penggunaan
# 构建所有代码仓库模块 sh satis.sh # 安装指定模块 sh satis.sh zhanghuizong/composer_satis_test
Salin selepas log masuk
Nota:
menentukan pemasangan modul, nama mestilah dikonfigurasikan dalam Medan nod repositori, sepadan dengan konfigurasi nod yang diperlukan
konfigurasi nginx
server { listen 80; server_name local.satis.com; root "/data/httpd/docker-config/composer_satis/test/public/"; location / { index index.php index.html; } location ~ \.php(.*)$ { fastcgi_pass php:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; } }
Salin selepas log masuk