Laravel 第一版 docker/entrypoint.sh 不要中文 20250529
This commit is contained in:
parent
f70d1a0c74
commit
0efea7c89f
@ -5,11 +5,11 @@ cd /var/www
|
||||
# Remove trailing slash from APP_DOMAIN if exists
|
||||
APP_DOMAIN="${APP_DOMAIN%/}"
|
||||
|
||||
# 預設 Redis 設定
|
||||
# Default Redis settings
|
||||
: "${REDIS_HOST:=redis}"
|
||||
: "${REDIS_PORT:=6379}"
|
||||
|
||||
# Clone 專案(只有第一次)
|
||||
# Clone the project (only the first time)
|
||||
if [ ! -d "html" ]; then
|
||||
if [ -n "$GIT_REPO_URL" ]; then
|
||||
echo "🔧 Cloning project from ${GIT_REPO_URL}..."
|
||||
@ -26,13 +26,13 @@ cd html
|
||||
echo "📦 Running composer install..."
|
||||
composer install --no-interaction --prefer-dist
|
||||
|
||||
# 複製 .env
|
||||
# Copy .env file if not exists
|
||||
if [ ! -f ".env" ]; then
|
||||
echo "⚙️ Copying .env.example to .env"
|
||||
cp .env.example .env
|
||||
fi
|
||||
|
||||
# 更新 .env 設定
|
||||
# Update .env configurations
|
||||
echo "🛠 Updating .env configurations..."
|
||||
|
||||
update_env_var() {
|
||||
@ -54,7 +54,7 @@ update_env_var "QUEUE_CONNECTION" "$QUEUE_CONNECTION"
|
||||
update_env_var "CACHE_DRIVER" "$CACHE_DRIVER"
|
||||
update_env_var "SESSION_DRIVER" "$SESSION_DRIVER"
|
||||
|
||||
# Laravel 初始化
|
||||
# Laravel initialization
|
||||
echo "🔑 Generating Laravel app key..."
|
||||
php artisan key:generate
|
||||
|
||||
@ -62,18 +62,18 @@ echo "🧱 Running migrations..."
|
||||
php artisan config:clear && cache:clear
|
||||
php artisan migrate --force
|
||||
|
||||
# 安裝 Node 套件與建構前端
|
||||
# Install Node.js packages and build frontend
|
||||
echo "🌐 Installing npm packages..."
|
||||
[ ! -d "node_modules" ] && npm install
|
||||
|
||||
echo "🛠 Building front-end assets..."
|
||||
npm run build
|
||||
|
||||
# 加入 Laravel Schedule 到 crontab(避免重複)
|
||||
# Add Laravel schedule to crontab (avoid duplicate entries)
|
||||
echo "⏱ Adding schedule:run to crontab..."
|
||||
crontab -l 2>/dev/null | grep -q 'schedule:run' || \
|
||||
(echo "* * * * * cd /var/www/html && php artisan schedule:run >> /dev/null 2>&1" | crontab -)
|
||||
|
||||
# 啟動 supervisord(同時啟動 queue + cron + php-fpm)
|
||||
# Start supervisord (to run queue + cron + php-fpm simultaneously)
|
||||
echo "🚀 Starting supervisord..."
|
||||
exec supervisord -n
|
Reference in New Issue
Block a user