Skip to content

Commit 2c9784e

Browse files
authored
fix(demo): pdo_mysql and MySQL retry for demo-smoke CI (#32)
Install the MySQL PDO driver in the demo FrankenPHP image and retry Doctrine setup until the database accepts connections, fixing flaky scheduled demo-smoke runs.
1 parent b809ebd commit 2c9784e

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

demo/symfony8/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM dunglas/frankenphp:1-php8.5-alpine
33

44
RUN apk add --no-cache git unzip bash
5-
RUN install-php-extensions intl pcov zip pdo_pgsql pdo_sqlite
5+
RUN install-php-extensions intl pcov zip pdo_mysql
66
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
77
RUN git config --global --add safe.directory /app && \
88
git config --global --add safe.directory /var/api-studio-bundle

demo/symfony8/Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,20 @@ up:
3434
fi
3535
@$(MAKE) link-bundle
3636
@$(COMPOSE) exec -T php php bin/console cache:clear --no-interaction
37-
@$(COMPOSE) exec -T php php bin/console nowo:api-studio:sync-schema --no-interaction
37+
@echo "Waiting for MySQL from PHP container..."
38+
@i=0; \
39+
while [ $$i -lt 30 ]; do \
40+
if $(COMPOSE) exec -T php php bin/console nowo:api-studio:sync-schema --no-interaction 2>/dev/null; then \
41+
break; \
42+
fi; \
43+
i=$$((i+1)); \
44+
sleep 2; \
45+
done; \
46+
if [ $$i -ge 30 ]; then \
47+
echo "MySQL not reachable from demo PHP container"; \
48+
$(COMPOSE) logs --tail=50 database php || true; \
49+
exit 1; \
50+
fi
3851
@$(COMPOSE) exec -T php php bin/console assets:install --no-interaction
3952
@$(MAKE) reset-demo
4053
@PORT=$$(grep "^PORT=" .env 2>/dev/null | cut -d= -f2 | tr -d '\r'); \

0 commit comments

Comments
 (0)