From dc51e0ebaed3359d3b0271c0696620b1d34e2f69 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 30 May 2020 12:52:02 +0200 Subject: [PATCH] Make worker wait for app init --- Dockerfile | 1 + worker-entrypoint.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100755 worker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index de571ec..a2935bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,7 @@ RUN set -xe;\ FROM reg.zknt.org/zknt/debian-php COPY --from=builder /var/www /var/www COPY entrypoint.sh /entrypoint.sh +COPY worker-entrypoint.sh /worker-entrypoint.sh 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 &&\ a2enmod rewrite &&\ diff --git a/worker-entrypoint.sh b/worker-entrypoint.sh new file mode 100755 index 0000000..a07ad0a --- /dev/null +++ b/worker-entrypoint.sh @@ -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