Skip to content

Commit f075644

Browse files
committed
Fix CI/CD
1 parent 0f7efa3 commit f075644

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/branch.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,11 @@ jobs:
163163
docker compose --file docker-compose-branch.yml pull && \
164164
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASSWD }} ${DOCKER_REGISTRY} && \
165165
docker compose --project-name ${DOCKER_BRANCH}-api_php --file docker-compose-branch.yml up -d --remove-orphans && \
166-
echo 'Waiting for container to be ready...' && \
166+
echo 'Waiting for Symfony container to be ready...' && \
167167
until docker exec ${DOCKER_BRANCH}-api_php-sf true 2>/dev/null; do sleep 2; done && \
168+
echo 'Waiting for MySQL to be ready...' && \
169+
until docker exec ${DOCKER_BRANCH}-api_php-db mysqladmin ping -h localhost --silent 2>/dev/null; do sleep 2; done && \
170+
sleep 5 && \
168171
echo 'Running migrations...' && \
169172
docker compose --project-name ${DOCKER_BRANCH}-api_php --file docker-compose-branch.yml exec -T symfony php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration && \
170173
echo 'Clearing cache...' && \

docker-compose-branch.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ services:
1313
# volumes:
1414
# - ./logs/symfony:/var/www/html/var/log:cached
1515
# - ./logs/nginx:/var/log/nginx:cached
16+
depends_on:
17+
db:
18+
condition: service_healthy
1619
labels:
1720
- "traefik.enable=true"
1821
- "traefik.http.routers.api-${DOCKER_BRANCH}.rule=Host(`${HOSTNAME}`)"
@@ -29,6 +32,12 @@ services:
2932
- "MYSQL_USER=${MYSQL_USER}"
3033
- "MYSQL_PASSWORD=${MYSQL_PASSWORD}"
3134
- "MYSQL_DATABASE=${MYSQL_DATABASE}"
35+
healthcheck:
36+
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "--silent" ]
37+
interval: 5s
38+
timeout: 3s
39+
retries: 10
40+
start_period: 30s
3241
restart: always
3342

3443
redis:
@@ -47,6 +56,9 @@ services:
4756
networks:
4857
- api-php
4958
- traefik-realt
59+
depends_on:
60+
db:
61+
condition: service_healthy
5062
labels:
5163
- "traefik.enable=true"
5264
- "traefik.http.routers.adminer-api-${DOCKER_BRANCH}.rule=Host(`adminer.${HOSTNAME}`)"

0 commit comments

Comments
 (0)