This repository has been archived on 2025-06-09. You can view files and clone it, but cannot push or open issues or pull requests.

57 lines
1.2 KiB
Bash

#!/bin/bash
cd /var/www/html
APP_URL="${APP_URL%/}"
# if [ ! -d "html" ]; then
# if [ -n "$GIT_REPO_URL" ]; then
# echo "Cloning project from ${GIT_REPO_URL}..."
# git clone "$GIT_REPO_URL" html
# else
# echo "GIT_REPO_URL not set. Skipping clone."
# exit 1
# fi
#fi
echo "Running composer install..."
composer install --no-interaction --prefer-dist
if [ ! -f ".env" ]; then
echo "Copying .env.example to .env"
cp .env.example .env
fi
echo "Updating .env configurations..."
update_env_var() {
local key=$1
local value=$2
grep -q "^${key}=" .env && \
sed -i "s|^${key}=.*|${key}=${value}|" .env || \
echo "${key}=${value}" >> .env
}
update_env_var "APP_NAME" "$APP_NAME"
update_env_var "APP_URL" "$APP_URL"
update_env_var "DB_HOST" "$DB_HOST"
update_env_var "DB_PORT" "$DB_PORT"
update_env_var "DB_DATABASE" "$DB_DATABASE"
update_env_var "DB_USERNAME" "$DB_USERNAME"
update_env_var "DB_PASSWORD" "$DB_PASSWORD"
echo "Generating Laravel app key..."
php artisan key:generate
echo "Running migrations..."
php artisan migrate --force
echo "Installing npm packages..."
[ ! -d "node_modules" ] && npm install
echo "Building front-end assets..."
npm run build
exec "$@"