Skip to content

Commit 5ddb737

Browse files
committed
Code build fix
1 parent 4eead2d commit 5ddb737

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

buildspec.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,27 @@ phases:
1111

1212
pre_build:
1313
commands:
14-
- echo Setting Laravel permissions...
15-
- cp .env.example .env
16-
- php artisan config:clear
17-
- php artisan cache:clear
18-
- php artisan config:cache
19-
- php artisan route:cache
20-
- php artisan view:cache
14+
- echo "🔧 Preparing Laravel environment..."
15+
16+
# Check if .env.production exists, then copy it
17+
- if [ -f .env.production ]; then cp .env.production .env; else cp .env.example .env; fi
18+
19+
# (Optional) Create SQLite file if using SQLite
20+
- if grep -q "DB_CONNECTION=sqlite" .env; then touch database/database.sqlite; fi
21+
22+
- echo "🧪 Running Laravel migrations..."
23+
- php artisan migrate --force
24+
25+
# Laravel Cache Optimization
26+
- php artisan optimize
2127

2228
build:
2329
commands:
24-
- echo Running Laravel Tests...
30+
- echo "🧪 Running Laravel Tests..."
2531
- php artisan test || true # You can fail the build if test fails
26-
- echo Build completed.
32+
33+
- echo "✅ Build completed."
2734

2835
post_build:
2936
commands:
30-
- echo Deployment ready! Triggering post-deployment hook...
37+
- echo "🚀 Deployment ready! Triggering post-deployment hook..."

0 commit comments

Comments
 (0)