1 Star 1 Fork 0

Holyhi/Docker Container - PHP Laravel

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
docker-php-laravel-setup 1.76 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/sh
if [ $(id -u) -eq 0 ]; then
export RUN_USER="root"
if [ $UID -gt 0 ] && [ $GID -gt 0 ]; then
export RUN_USER=$(getent passwd "$UID" | cut -d: -f1)
if [ -z $RUN_USER ]; then
export RUN_USER="container"
fi
# if the specify user not exists, create it
if [ -z "$(cat /etc/passwd | grep :$UID:$GID:)" ]; then
# delete user and group if exists
(/usr/sbin/deluser $RUN_USER > /dev/null)
(/usr/sbin/delgroup $RUN_USER > /dev/null)
# create user
/usr/sbin/addgroup --gid $GID $RUN_USER
/usr/sbin/adduser --disabled-password --gecos "" --home /var/www --ingroup container --no-create-home --uid $UID $RUN_USER
# create config folder
mkdir -p /var/www/.config
chown -R $UID:$GID /var/www/.config
fi
export APACHE_RUN_USER=$RUN_USER
export APACHE_RUN_GROUP=$RUN_USER
fi
# export the container user
if [ -z "$(cat /root/.env | grep RUN_USER=$RUN_USER)" ]; then
echo "export RUN_USER=$RUN_USER" >> /root/.env
echo "export APACHE_RUN_USER=$RUN_USER" >> /root/.env
echo "export APACHE_RUN_GROUP=$RUN_USER" >> /root/.env
echo ". /root/.env" >> /root/.bashrc
fi
# start supervisord
if [ `expr match "$SUPERVISORD" "[O|o][N|n]$"` -ne 0 ]; then
(/usr/bin/supervisord -c /usr/local/etc/supervisord.conf > /dev/null) &
echo "supervisord started"
fi
# start cron
if [ `expr match "$SCHEDULE" "[O|o][N|n]$"` -ne 0 ]; then
/usr/bin/crontab /usr/local/etc/crontab.txt
/etc/init.d/cron start
echo "cron started"
fi
else
echo "You should specify the execution user by '-e UID=1000' and '-e GID=1000'."
exit 1
fi
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Docker
1
https://gitee.com/holyhi/docker-php-laravel.git
git@gitee.com:holyhi/docker-php-laravel.git
holyhi
docker-php-laravel
Docker Container - PHP Laravel
master

搜索帮助