Docker 运行 composer 在启动脚本中,composer 从不运行

Docker running composer in startup script, composer never runs

我有一个 docker 容器,它实际上是一个 LAMP 堆栈。我正在使用 supervisord 来管理流程。

我可以在容器启动时执行 bash 脚本,但我无法将脚本获取到 运行 composer。

我的简单脚本

#!/bin/bash

git clone https://github.com/[..project..].git /var/www/
wait

composer update -d /var/www/
wait

# Just here to test if we make it this far...
touch /var/www/test

exit

以及 supervisord.conf 中负责 运行 的部分

[program:deploy]
command=bash deploy.sh
directory=/usr/local/bin/
user=root
autostart=true
autorestart=false
environment=PATH="/usr/bin"
redirect_stderr=true

这会成功克隆存储库,并触及测试文件但会跳过 运行ning composer。如果我在容器中打开一个 shell 我可以成功地手动执行脚本。

关于如何解决这个问题有什么建议吗?

问题出在我的 supervisord 配置上。

正确的配置是

[program:deploy]
command=bash /usr/local/bin/deploy.sh
autostart=true
autorestart=false
redirect_stderr=true
stdout_logfile=/var/log/composer/run.log