From ad737b49bb514793be65e74ebe8332e67e6f4625 Mon Sep 17 00:00:00 2001
From: IceTeaXXD <13521024@std.stei.itb.ac.id>
Date: Fri, 10 Nov 2023 22:37:09 +0700
Subject: [PATCH] chore: docker setups

---
 config/.env.example | 18 ++++++------------
 docker-compose.yml  | 26 ++++++++++----------------
 2 files changed, 16 insertions(+), 28 deletions(-)

diff --git a/config/.env.example b/config/.env.example
index d40d975..3d73bf6 100644
--- a/config/.env.example
+++ b/config/.env.example
@@ -1,12 +1,6 @@
-DB_HOST=
-DB_USER=
-DB_PASSWORD=
-DB_NAME=
-
-# FOR DOCKER
-# DB_HOST=db
-# DB_USER=php_docker
-# DB_PASSWORD=password
-# DB_NAME=php_docker
-# SOAP_KEY=shortT_Key
-# WSDL=http://soap-service:8080/ws/
\ No newline at end of file
+DB_HOST=web-db
+DB_USER=scholee
+DB_PASSWORD=password
+DB_NAME=scholee
+SOAP_KEY=shortT_Key
+WSDL=http://soap-service:8080/ws/
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 5579c64..5d48419 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,28 +1,22 @@
 version: '3.3'
 services:
-  db: 
-    image: mysql:latest
+  web-db: 
+    image: mysql:8.0
     environment:
       - MYSQL_DATABASE=scholee
       - MYSQL_USER=scholee
-      - MYSQL_PASSWORD=password # this should live in a env var
-      - MYSQL_ALLOW_EMPTY_PASSWORD=1 # equivalent to True
+      - MYSQL_PASSWORD=password
+      - MYSQL_ALLOW_EMPTY_PASSWORD=1
     volumes:
-      - "./db:/docker-entrypoint-initdb.d" # this is how we persist a sql db even when container stops
-  php-apache:
+      - "./db:/docker-entrypoint-initdb.d"
+  web-service:
     build:
       context: .
       dockerfile: Dockerfile
     image: php:8.0-apache
     volumes:
-      - ".:/var/www/html" # sync the current dir on local machine to the dir of container
+      - ".:/var/www/html"
     ports:
-      - 3000:80 # for future http traffic
-      - 443:443 # for future ssl traffic
-  phpmyadmin:
-    image: phpmyadmin/phpmyadmin
-    ports:
-      - 8001:80
-    environment:
-      - PMA_HOST=db
-      - PMA_PORT=3306
\ No newline at end of file
+      - 3000:80
+    depends_on:
+      - web-db
-- 
GitLab