Skip to content

Commit f62f47d

Browse files
committed
Code build fix
1 parent dcbefa7 commit f62f47d

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

β€Žbuildspec.ymlβ€Ž

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,54 @@ version: 0.2
33
phases:
44
install:
55
runtime-versions:
6-
php: 8.3
6+
php: 8.3 # Use PHP 8.3 runtime
77
commands:
8-
- echo Installing Composer and dependencies...
8+
- echo "πŸ“¦ Installing Composer and Laravel dependencies..."
9+
10+
# Install Composer locally (without global install)
911
- curl -sS https://getcomposer.org/installer | php
1012
- php composer.phar install --no-interaction --prefer-dist --optimize-autoloader
11-
- echo "Composer dependencies installed."
13+
- echo "βœ… Composer dependencies installed."
1214

13-
- echo "Installing additional dependencies..."
15+
# Install additional system packages if needed (e.g., SQLite for testing)
16+
- echo "πŸ“₯ Installing additional system dependencies..."
1417
- export DEBIAN_FRONTEND=noninteractive
1518
- apt-get update
1619
- apt-get install -y sqlite3
17-
- echo "Additional dependencies installed."
20+
- echo "βœ… System dependencies installed."
1821

1922
pre_build:
2023
commands:
2124
- echo "πŸ”§ Preparing Laravel environment..."
2225

23-
# Check if .env.production exists, then copy it
26+
# Copy production environment file if it exists
2427
- if [ -f .env.production ]; then cp .env.production .env; else cp .env.example .env; fi
28+
- echo "πŸ“„ Environment file set."
2529

26-
# (Optional) Create SQLite file if using SQLite
30+
# Optional: Create empty SQLite file if DB_CONNECTION is set to sqlite
2731
- if grep -q "DB_CONNECTION=sqlite" .env; then touch database/database.sqlite; fi
32+
- echo "πŸ—ƒοΈ SQLite database initialized if needed."
2833

29-
- echo "πŸ§ͺ Running Laravel migrations..."
34+
# Run database migrations
35+
- echo "🧱 Running Laravel migrations..."
3036
- php artisan migrate --force
3137

32-
- echo "πŸ”‘ Generating application key..."
38+
# Generate application encryption key
39+
- echo "πŸ”‘ Generating Laravel app key..."
3340
- php artisan key:generate --force
3441

35-
- echo "πŸš€ Optimizing Laravel..."
42+
# Laravel optimization (combines config, route, and view caching)
43+
- echo "πŸš€ Running Laravel optimization commands..."
3644
- php artisan optimize
45+
- echo "βœ… Laravel optimized."
3746

3847
build:
3948
commands:
40-
- echo "πŸ§ͺ Running Laravel Tests..."
49+
- echo "πŸ§ͺ Running Laravel unit tests..."
4150
- php artisan test --testsuite=Unit --stop-on-failure
4251

43-
- echo "βœ… Build completed."
52+
- echo "βœ… Build and testing phase completed."
4453

4554
post_build:
4655
commands:
47-
- echo "πŸš€ Deployment ready! Triggering post-deployment hook..."
56+
- echo "πŸš€ Post-build: Ready for deployment trigger or next pipeline stage."

0 commit comments

Comments
Β (0)