From 907f393a010a304a125a04822d95c47b41cd8751 Mon Sep 17 00:00:00 2001 From: Dolev Farhi Date: Fri, 10 Nov 2023 22:14:22 -0500 Subject: [PATCH] Fix database startup --- lab/machines/c-db-01/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lab/machines/c-db-01/Dockerfile b/lab/machines/c-db-01/Dockerfile index eff9092..e641c5a 100644 --- a/lab/machines/c-db-01/Dockerfile +++ b/lab/machines/c-db-01/Dockerfile @@ -6,6 +6,8 @@ LABEL company="ACME Infinity Servers" # Variables ENV DEBIAN_FRONTEND=noninteractive +ENV DB_ADMINER_FILE="/var/www/html/database.sql" +ENV DB_CUSTOMERS_FILE="/var/tmp/customers.sql" # Install Required Packages RUN apt-get update -y --fix-missing @@ -29,10 +31,8 @@ RUN chmod 777 /var/www/html/uploads # Entry ENTRYPOINT service mariadb restart \ && \ - cat /var/www/html/database.sql | mysql -u root \ + if [[ -f "${DB_ADMINER_FILE}" ]]; then cat "${DB_ADMINER_FILE}" | mysql -u root; fi \ && \ - cat /var/tmp/customers.sql | mysql -u root \ - && \ - rm /var/tmp/customers.sql \ + if [[ -f "${DB_CUSTOMERS_FILE}" ]]; then cat "${DB_CUSTOMERS_FILE}" | mysql -u root; rm "${DB_CUSTOMERS_FILE}"; fi \ && \ /usr/sbin/apache2ctl -D FOREGROUND \ No newline at end of file