Initial work done on Docker composition of TT and MariaDB together.
authorNik Okuntseff <support@anuko.com>
Sat, 29 Dec 2018 18:22:42 +0000 (18:22 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 29 Dec 2018 18:22:54 +0000 (18:22 +0000)
Dockerfile
WEB-INF/templates/footer.tpl
docker-compose.yml [new file with mode: 0644]

index 37cf6bf..1cbf6af 100644 (file)
@@ -25,5 +25,11 @@ RUN apt-get install libldap2-dev -y \
 # The above does not work. Files are removed, but
 # image files (zipped or not) are not getting smaller. Why?
 
+# Copy application source code to /var/www/html/.
 COPY . /var/www/html/
-
+# Create configuration file.
+RUN cp /var/www/html/WEB-INF/config.php.dist /var/www/html/WEB-INF/config.php
+# Replace DSN value to something connectable to a Docker container running mariadb.
+RUN sed -i "s|mysqli://root:no@localhost/dbname|mysqli://anuko_user:anuko_pw@anuko_sql/timetracker|g" /var/www/html/WEB-INF/config.php
+# Note that db is defined as anuko_sql/timetracker where anuko_sql is service name and timetracker is db name.
+# See docker-compose.yml for details.
index 9a62b14..f2ab255 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.36.4694 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.36.4695 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..b5ecef9
--- /dev/null
@@ -0,0 +1,26 @@
+version: '3.7'
+
+services:
+  # anuko_tt is a web application built as per Dockerfile specification.
+  anuko_tt:
+    build: .
+    image: anuko_timetracker:dev
+    container_name: anuko-timetracker
+    # Use localhost:8080 to connect to timetracker via browser.
+    ports:
+     - "8080:80"
+
+  # anuko_sql is a mariadb instance to which timetracker connects.
+  # Connect parameters are also specified in timetracker Dockerfile after
+  # creation of its configuration file. Specifically, we replace
+  # user name, password, service name (aka resolvable to IP server name
+  # where mariadb runs), and database name there from the defaults.
+  # Apparently, these two sets of credentials must match for successful connect.
+  anuko_sql:
+    image: "mariadb:latest"
+    container_name: anuko-sql
+    environment:
+      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
+      MYSQL_DATABASE: timetracker
+      MYSQL_USER: anuko_user
+      MYSQL_PASSWORD: anuko_pw