Skip to content

Commit 886aee4

Browse files
committed
ci: make mariadb start more stable
1 parent aacedff commit 886aee4

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Dockerfile

+20-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ USER root
3939

4040
RUN <<EOF
4141
set -e
42-
42+
4343
apk add --no-cache \
4444
php-8.3 \
4545
php-8.3-fileinfo \
@@ -80,8 +80,25 @@ RUN <<EOF
8080
mkdir -p /var/tmp /run/mysqld
8181
mariadb-install-db --datadir=/var/lib/mariadb --user=root
8282

83-
/usr/bin/mariadbd --basedir=/usr --datadir=/var/lib/mariadb --plugin-dir=/usr/lib/mariadb/plugin --user=root &
84-
sleep 2
83+
mariadbd --basedir=/usr --datadir=/var/lib/mariadb --plugin-dir=/usr/lib/mariadb/plugin --user=root &
84+
85+
i=1
86+
while [ $i -le 10 ]; do
87+
if mariadb-admin ping; then
88+
echo "Successfully connected to MariaDB on attempt $i!"
89+
break
90+
else
91+
echo "Attempt $i failed. Retrying in 5 seconds..."
92+
sleep 5
93+
fi
94+
i=$((i + 1))
95+
done
96+
97+
if [ $i -gt 10 ]; then
98+
echo "Failed to connect to MariaDB after 10 attempts."
99+
exit 1
100+
fi
101+
85102
mariadb-admin --user=root password 'root'
86103
php bin/console system:install --create-database --force
87104
mariadb -proot shopware -e "DELETE FROM sales_channel WHERE id = 0x98432def39fc4624b33213a56b8c944d"

0 commit comments

Comments
 (0)