Make worker wait for app init

This commit is contained in:
chris 2020-05-30 12:52:02 +02:00
parent 6e058f3d31
commit dc51e0ebae
2 changed files with 14 additions and 0 deletions

View file

@ -20,6 +20,7 @@ RUN set -xe;\
FROM reg.zknt.org/zknt/debian-php FROM reg.zknt.org/zknt/debian-php
COPY --from=builder /var/www /var/www COPY --from=builder /var/www /var/www
COPY entrypoint.sh /entrypoint.sh COPY entrypoint.sh /entrypoint.sh
COPY worker-entrypoint.sh /worker-entrypoint.sh
COPY wait-for-db.php /wait-for-db.php COPY wait-for-db.php /wait-for-db.php
RUN apt-install php-curl php-zip php-bcmath php-intl php-mbstring php-xml optipng pngquant jpegoptim gifsicle ffmpeg php-imagick php-gd php-redis php-mysql &&\ RUN apt-install php-curl php-zip php-bcmath php-intl php-mbstring php-xml optipng pngquant jpegoptim gifsicle ffmpeg php-imagick php-gd php-redis php-mysql &&\
a2enmod rewrite &&\ a2enmod rewrite &&\

13
worker-entrypoint.sh Executable file
View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -xeo pipefail
php /wait-for-db.php
if [[ ! -e storage/.docker.init ]];
then
echo "Database is not initialized yet, exiting..."
sleep 5
exit 1
fi
gosu www-data php artisan horizon