diff --git a/docker-compose.yml b/docker-compose.yml index ce7de3a..2820e7b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,6 +15,11 @@ services: BRANCH: ${REPO_BRANCH:-main} DB_HOST: mariadb DB_PORT: 3306 + REDIS_HOST: redis + REDIS_PORT: 6379 + SESSION_DRIVER: redis + QUEUE_CONNECTION: redis + CACHE_STORE: redis APP_NAME: ${APP_NAME} APP_URL: ${APP_URL} NGINX_HOST: ${APP_DOMAIN} diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 617332b..e00a078 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -9,12 +9,13 @@ TARGET_DIR=/var/www/html if [ -z "$(ls -A "$TARGET_DIR")" ]; then echo "[entrypoint] Cloning $BRANCH from $REPO_URL ..." git clone --branch "$BRANCH" "$REPO_URL" "$TARGET_DIR" + cd "$TARGET_DIR" else echo "[entrypoint] Repository already present, pulling." + cd "$TARGET_DIR" git pull origin "$BRANCH" fi -cd "$TARGET_DIR" # 2) Laravel 基礎安裝 [ -d vendor ] || composer install --no-interaction --prefer-dist @@ -25,6 +26,11 @@ update_env APP_NAME "$APP_NAME" update_env APP_URL "${APP_URL%/}" update_env DB_HOST "$DB_HOST" update_env DB_PORT "$DB_PORT" +update_env REDIS_HOST "$DB_PORT" +update_env REDIS_PORT "$DB_PORT" +update_env SESSION_DRIVER "$SESSION_DRIVER" +update_env QUEUE_CONNECTION "$QUEUE_CONNECTION" +update_env CACHE_STORE "$CACHE_STORE" php artisan key:generate --force php artisan migrate --force