From 9b26ff1cd46509172ca44b344d7c3d004b1a0465 Mon Sep 17 00:00:00 2001 From: GotPPay Date: Tue, 26 Jun 2018 13:47:39 +0200 Subject: [PATCH] create start-up script for migration --- ...45_add_billing_info_to_order_migration.php | 41 +++++++++++++++++++ docker/php/startup.sh | 13 ++++++ php.dockerfile | 18 +++++--- 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 api-wiaas/db/migrations/20180625145945_add_billing_info_to_order_migration.php create mode 100644 docker/php/startup.sh diff --git a/api-wiaas/db/migrations/20180625145945_add_billing_info_to_order_migration.php b/api-wiaas/db/migrations/20180625145945_add_billing_info_to_order_migration.php new file mode 100644 index 0000000..b970b3b --- /dev/null +++ b/api-wiaas/db/migrations/20180625145945_add_billing_info_to_order_migration.php @@ -0,0 +1,41 @@ +table('orders'); + $ordersTable->addColumn('billingFirstName', 'string', ['limit' => 100, 'null' => true, 'after'=>'billingAddress']) + ->addColumn('billingLastName', 'string', ['limit'=>100, 'null'=> true, 'after'=>'billingFirstName']) + ->addColumn('billingMail', 'string', ['limit'=>300, 'null' => true, 'after'=>'billingLastName']) + ->save(); + } +} diff --git a/docker/php/startup.sh b/docker/php/startup.sh new file mode 100644 index 0000000..d6ffb36 --- /dev/null +++ b/docker/php/startup.sh @@ -0,0 +1,13 @@ +#!/bin/sh + + +#migrate DB +cd /var/www/html/api-wiaas +while ! mysqladmin ping -h"db" --silent; do + sleep 1 +done +echo "Ready...." +vendor/bin/phinx migrate -e development + +#start image +exec apache2-foreground \ No newline at end of file diff --git a/php.dockerfile b/php.dockerfile index 25a0e4c..801a910 100644 --- a/php.dockerfile +++ b/php.dockerfile @@ -17,19 +17,22 @@ ENV DB_SERVER=db \ ENV DEV_DB_HOST=db \ DEV_DB_NAME=ricoh_dash \ DEV_DB_USER=developer \ - DEV_DB_PASS=developer + DEV_DB_PASS=developer \ + DEV_DB_PORT=3306 ENV PROD_DB_HOST=db \ PROD_DB_NAME=ricoh_dash \ PROD_DB_USER=developer \ - PROD_DB_PASS=developer + PROD_DB_PASS=developer \ + DEV_DB_PORT=3306 ENV TEST_DB_HOST=db \ TEST_DB_NAME=ricoh_dash \ TEST_DB_USER=developer \ - TEST_DB_PASS=developer + TEST_DB_PASS=developer \ + DEV_DB_PORT=3306 -RUN apt-get update && apt-get install -y git unzip gnupg +RUN apt-get update && apt-get install -y git unzip gnupg mysql-client RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get install -y nodejs @@ -38,8 +41,9 @@ RUN a2enmod rewrite COPY docker/php/apache2.conf /etc/apache2/ COPY docker/php/composer.phar /usr/local/bin/composer +COPY docker/php/startup.sh /init-scripts/ -RUN chmod 755 /usr/local/bin/composer +RUN chmod 755 /usr/local/bin/composer && chmod +x /init-scripts/startup.sh COPY api-wiaas /home/wiaas/api-wiaas COPY client-wiaas /home/wiaas/client-wiaas @@ -55,4 +59,6 @@ RUN npm rebuild node-sass --force RUN npm install && npm run build RUN cp -r build/* /var/www/html/ -COPY docker/php/.htaccess /var/www/html/ \ No newline at end of file +COPY docker/php/.htaccess /var/www/html/ + +CMD /init-scripts/startup.sh \ No newline at end of file