feat: fix ci/cd
This commit is contained in:
parent
64a82d0e2c
commit
f874100def
|
|
@ -24,8 +24,7 @@ services:
|
|||
image: registry.gitlab.com/treasure-hunt4/treasure-api:latest
|
||||
restart: "no"
|
||||
depends_on:
|
||||
mysql:
|
||||
condition: service_healthy
|
||||
- mysql
|
||||
environment:
|
||||
APP_ENV: "production"
|
||||
APP_KEY: "${APP_KEY}"
|
||||
|
|
@ -37,7 +36,14 @@ services:
|
|||
DB_USERNAME: "${DB_USERNAME}"
|
||||
DB_PASSWORD: "${DB_PASSWORD}"
|
||||
|
||||
command: ["php", "artisan", "migrate", "--force", "--no-interaction"]
|
||||
# On attend que MySQL soit joignable avant de migrer
|
||||
command: >
|
||||
sh -c "
|
||||
echo '⏳ Waiting for MySQL on mysql:3306...';
|
||||
php -r 'while (!@fsockopen(\"mysql\", 3306)) { echo \"MySQL not ready, retrying...\n\"; sleep(2);}';
|
||||
echo '✅ MySQL is up, running migrations...';
|
||||
php artisan migrate --force --no-interaction
|
||||
"
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
|
|
@ -52,7 +58,15 @@ services:
|
|||
ports:
|
||||
- "3308:3306" # Optionnel, pour accès externe à MySQL
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${MYSQL_ROOT_PASSWORD}"]
|
||||
test:
|
||||
[
|
||||
"CMD",
|
||||
"mysqladmin",
|
||||
"ping",
|
||||
"-h",
|
||||
"localhost",
|
||||
"-p${MYSQL_ROOT_PASSWORD}",
|
||||
]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
|
|
|
|||
Loading…
Reference in New Issue