diff --git a/Containerfile b/Containerfile index e3d5d0c..76a2a29 100644 --- a/Containerfile +++ b/Containerfile @@ -48,6 +48,7 @@ COPY --from=builder /var/www /var/www COPY entrypoint.sh /entrypoint.sh COPY worker-entrypoint.sh /worker-entrypoint.sh COPY websockets-entrypoint.sh /websockets-entrypoint.sh +COPY schedule-entrypoint.sh /schedule-entrypoint.sh COPY wait-for-db.php /wait-for-db.php COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20210902 /usr/local/lib/php/extensions/no-debug-non-zts-20210902 COPY --from=builder /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d diff --git a/schedule-entrypoint.sh b/schedule-entrypoint.sh new file mode 100644 index 0000000..c6685aa --- /dev/null +++ b/schedule-entrypoint.sh @@ -0,0 +1,21 @@ +#!/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 migrate:status | grep No && migrations=yes || migrations=no +if [ $migrations = "yes" ]; +then + echo "Database needs migrations, exiting..." + sleep 5 + exit 1 +fi + +gosu www-data php artisan schedule:work