From 01684a4cc820a8e147f8797db8f2fbb723a383ab Mon Sep 17 00:00:00 2001 From: Ante de Baas Date: Thu, 28 Sep 2023 20:48:32 +0200 Subject: [PATCH] add migrations to docker startup --- dockerfiles/{genenvlocal.sh => containerstartup.sh} | 7 ++++++- dockerfiles/supervisord.conf | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) rename dockerfiles/{genenvlocal.sh => containerstartup.sh} (84%) diff --git a/dockerfiles/genenvlocal.sh b/dockerfiles/containerstartup.sh similarity index 84% rename from dockerfiles/genenvlocal.sh rename to dockerfiles/containerstartup.sh index 3c139b7..6eca509 100644 --- a/dockerfiles/genenvlocal.sh +++ b/dockerfiles/containerstartup.sh @@ -1,4 +1,6 @@ #!/bin/sh + +echo "Generate .env.local file" if [ ! -f "/var/www/html/.env.local" ]; then APP_SECRET=$(echo "$RANDOM" | md5sum | head -c 32) echo "APP_ENV=prod" >> /var/www/html/.env.local @@ -8,4 +10,7 @@ if [ ! -f "/var/www/html/.env.local" ]; then echo "MAILBOX_CONNECTION=\"$MAILER_HOST:$MAILER_IMAPPORT/imap/ssl\"" >> /var/www/html/.env.local echo "MAILBOX_USERNAME=\"$MAILER_USER\"" >> /var/www/html/.env.local echo "MAILBOX_PASSWORD=\"$MAILER_PASSWORD\"" >> /var/www/html/.env.local -fi \ No newline at end of file +fi + +echo "Run migrations" +php /var/www/html/bin/console doctrine:migrations:migrate --no-interaction \ No newline at end of file diff --git a/dockerfiles/supervisord.conf b/dockerfiles/supervisord.conf index 8c22c9a..a7789fc 100644 --- a/dockerfiles/supervisord.conf +++ b/dockerfiles/supervisord.conf @@ -6,7 +6,7 @@ pidfile=/run/supervisord.pid user=root [program:genconfig] -command=/usr/local/bin/genenvlocal.sh +command=/usr/local/bin/containerstartup.sh stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr