gpt4 book ai didi

git - 带有Docker构建的PHP和Composer:无法克隆git

转载 作者:行者123 更新时间:2023-12-02 19:11:44 27 4
gpt4 key购买 nike

我正在尝试按照安装指南创建Dockerfile以自动安装HumHub:https://www.humhub.org/docs/guide-admin-installation.html

但是,每当构建脚本运行composer时,都会出现以下错误:

Changed current directory to /root/.composer
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fxp/composer-asset-plugin (v1.1.1)
Downloading: Connecting... Failed to download fxp/composer-asset-plugin from dist: Could not authenticate against github.com
Now trying to download from source
- Installing fxp/composer-asset-plugin (v1.1.1)
Cloning daca454b94539a4e6d30937dfc6b817eceb03f28

Writing lock file
Generating autoload files
Loading composer repositories with package information
Updating dependencies (including require-dev)
Failed to clone the git@github.com:jquery/jquery-dist.git repository, try running in interactive mode so that you can enter your GitHub credentials

[RuntimeException]
Failed to execute git clone --mirror 'git@github.com:jquery/jquery-dist.git' '/root/.composer/cache/vcs/git-github.com-jquery-jquery-dist.git/'

大概这是由使用git来安装jquery的 Composer 引起的,并且期望git被预先配置为git访问凭据。但是,为Docker构建脚本提供git访问凭据没有任何意义。

我试图强制git和composer都使用https(请参阅 How to force Composer to use https:// instead of git://?),但是它似乎没有达到预期的效果。这可能是由于composer插件composer-asset-plugin中的错误引起的吗?

这是构建文件:
FROM orukami/alpine-php:5.6

ENV WWW_ROOT /var/www
ENV PUBLIC_ROOT /var/www/public

COPY nginx /etc/nginx
COPY fpm /etc/php/fpm
COPY supervisord.conf /etc/supervisord.conf
COPY entrypoint.sh /

RUN apk add -U nginx supervisor git curl && \
mkdir -p /var/www && mkdir -p ${WWW_ROOT} && \
rm -rf /var/cache/apk/* && \
chmod +x /entrypoint.sh

RUN git clone https://github.com/humhub/humhub.git /var/www/public
RUN cd /var/www/public && curl -sS https://getcomposer.org/installer | php
RUN git config --global url."https://".insteadOf "git://" && cd /var/www/public && \
./composer.phar config --global github-protocols https && \
./composer.phar global require "fxp/composer-asset-plugin:~1.1.0" && \
./composer.phar update

WORKDIR ${WWW_ROOT}

EXPOSE 80 443

VOLUME /var/www/public

ENTRYPOINT ["/entrypoint.sh"]

CMD ["/usr/bin/supervisord"]

这肯定是一个非常普遍的问题,但是我根本无法在线找到任何解决方案。

最佳答案

该问题最终被追溯到composer-asset-plugin不遵守通过https而不是git://加载的指令。解决方案是将以下文件复制:https://github.com/djcf/humhub-docker/blob/master/config.json到/root/.composer。

关于git - 带有Docker构建的PHP和Composer:无法克隆git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35159635/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com