Enable Alibaba Cloud Composer Full Image in the Global Configuration in a Windows 10/Docker deployment
1. Check the list of global configuration options for Composer. Open the command line window and execute the following command: the image address is the official source address. as shown in Figure 1
PS E:\wwwroot\pcs-api> composer config --global --list
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://packagist.phpcomposer.com
[process-timeout] 300
[use-include-path] false
[preferred-install] auto
[notify-on-install] true
[github-protocols] [https, ssh]
[vendor-dir] vendor (E:\wwwroot\pcs-api/vendor)
[bin-dir] {$vendor-dir}/bin (E:\wwwroot\pcs-api/vendor/bin)
[cache-dir] C:/Users/Administrator/AppData/Local/Composer
[data-dir] C:/Users/Administrator/AppData/Roaming/Composer
[cache-files-dir] {$cache-dir}/files (C:/Users/Administrator/AppData/Local/Composer/files)
[cache-repo-dir] {$cache-dir}/repo (C:/Users/Administrator/AppData/Local/Composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (C:/Users/Administrator/AppData/Local/Composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[bin-compat] auto
[discard-changes] false
[autoloader-suffix]
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile]
[capath]
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[home] C:/Users/Administrator/AppData/Roaming/Composer
[github-oauth.github.com] 3e868f4f7e6ff6691f1a2c7fe5e8dbd8a174650f
2. Open Alibaba Cloud Composer full image URL:https://developer.aliyun.com/composer
3. System global configuration: Add the configuration information to the global configuration file config.json of Composer. Open the command line window and execute the following commands:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
4. In the Docker deployment, enable the full image of Alibaba Cloud Composer in the global configuration, and edit the file Dockerfile, as shown in Figure 3
FROM registry-vpc.cn-beijing.aliyuncs.com/cmc/centos-nginx112-php72:0.1.7
MAINTAINER wjtester@sobey.com
RUN sed -i 's/open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv/;open_basedir = .\/:\/sobey:\/tmp:\/data:\/webtv:\/usr\/local\/php/g' /usr/local/php/etc/php.ini && \
sed -i 's/allow_url_fopen = Off/allow_url_fopen = On/g' /usr/local/php/etc/php.ini && \
sed -i 's/disable_functions = exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show/disable_functions = system,shell_exec,escapeshellarg,escapeshellcmd,dl,popen,show/g' /usr/local/php/etc/php.ini
COPY code /sobey/www/pcs-api
COPY code/build/c_files/ /
RUN chown -R nginx:nginx /sobey/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 /sobey/www/pcs-api && \
composer install
5. Rebuild the Docker image, the execution process is faster and more stable. It took 35 minutes before, and now it takes 18 minutes, as shown in Figure 4, Figure 5



