问题描述
我正尝试在 /rel =nofollow> OpenShift 与一个免费节点。我可以从SSH会话中运行 composer update
,没有任何问题。
唯一的问题是每当我想通过 git 提交文件时,我必须转到控制台并运行作曲家再次安装
。我的问题是有什么简单的方法来解决这个问题?我在 /project/.openshift/action_hooks/post_deploy 中尝试了BASH脚本,但服务器未在运行时/ repo下创建供应商文件夹
我总是通过
I am trying to use Slim on OpenShift with a free node. I can run composer update
from the SSH sessions without any problem.
The only problem is every time I want to commit files through git I have to go to the console and run composer install
again. My question is there is any easy way to workaround this? I tried a BASH script in /project/.openshift/action_hooks/post_deploy but the server is not creating the vendor folder under runtime/repo
I always do it via action hooks:
Inside my project directory I have a script called by /project/.openshift/action_hooks/post_deploy
where post_deploy is a bash script.Here goes what I have been using:
#!/bin/bash
export MY_PHPCOMPOSER=$OPENSHIFT_DATA_DIR/composer.phar
# if composer not exists, download
if [ ! -f $MY_PHPCOMPOSER ]; then
cd $OPENSHIFT_DATA_DIR
echo "Downloading composer..."
php -r "readfile('https://getcomposer.org/installer');" | php
fi
$MY_PHPCOMPOSER -n -q self-update
cd $OPENSHIFT_REPO_DIR
# install
php -dmemory_limit=1G $MY_PHPCOMPOSER install
So post_deploy script will perform every time which you push your repo to openshit. It work like a charm!
Side note
Helpful links
这篇关于我如何在OpenShift上作曲者更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!