Home > Development Tools > composer > Quickly build composer intranet code warehouse

Quickly build composer intranet code warehouse

藏色散人
Release: 2021-08-03 15:14:39
forward
2968 people have browsed it

The following column composer tutorial will introduce to you how to build an intranet composer satis code warehouse with Docker. I hope it will be helpful to friends in need!

Quickly build composer intranet code warehouse

Build composer intranet code warehouse

Pull composer/satis image

docker pull composer/satis
Copy after login

Configure composer

This step can be skipped

Directory structure

├── auth.json
├── cache
│   ├── files
│   ├── repo
│   └── vcs
├── composer.json
└── config.json
Copy after login

composer.json

{
}
Copy after login

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/"
        }
    }
}
Copy after login

Building module extension

Directory structure

├── config.json
├── public
│   ├── dist
│   │   ├── bpc
│   │   └── zhanghuizong
│   ├── include
│   │   └── all$f3811758e4611a4dfc1a96f4d1c06da09cdbe199.json
│   ├── index.html
│   └── packages.json
└── satis.sh
Copy after login

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"
    }
}
Copy after login
Keywords Description
repositories Specify where to get the package
require Specify which packages to get. If you want to get all packages, use require-all: true
archive.directory output-dir Even if the build output directory
archive.format is optional, Default: zip, supports two compression formats: zip, tar. The compression format used when building
archive.skip-dev Optional, false by default, when enabled (true) satis will not create branches for branches Download
archive.prefix-url Optional download location, homepage (from satis.json), by default directory
Official website description: https://docs.phpcomposer.com/articles/handling-private-packages-with-satis.html
GitHub code: https://github.com/composer/ satis

shell script

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 "$@"
Copy after login

Add quick access

Edit file: 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'
Copy after login

Usage

# 构建所有代码仓库模块
sh satis.sh

# 安装指定模块
sh satis.sh zhanghuizong/composer_satis_test
Copy after login

Note

Specify module installation, the name field must be configured in the repositories node, and correspond to the require node configuration

nginx configuration

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;
        }
}
Copy after login

Quickly build composer intranet code warehouse

The above is the detailed content of Quickly build composer intranet code warehouse. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template