From 6b62df95f036598a6cac0368f8bd35cc4efa4959 Mon Sep 17 00:00:00 2001 From: Matthew Florentino Date: Mon, 24 Nov 2025 10:15:04 +0700 Subject: [PATCH] fix: fixed bug css cache at browser and fixing named container docker --- .gitignore | 2 -- docker-compose.yaml | 50 ++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 53 ------------------------------------------ dockerfile | 7 ++++++ src/config/db.php | 4 ++-- src/css/style.css | 56 +++++++++++++++++++++++++++++++++++++++++++++ src/index.php | 4 ++-- web/Dockerfile | 18 --------------- 8 files changed, 117 insertions(+), 77 deletions(-) delete mode 100644 .gitignore create mode 100644 docker-compose.yaml delete mode 100644 docker-compose.yml create mode 100644 dockerfile delete mode 100644 web/Dockerfile diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 9dd6699..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.env -.docs.txt \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..a4951e7 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,50 @@ +version: "3.8" + +services: + phpapache: + build: + context: . + dockerfile: Dockerfile + container_name: codebeater_phpapache + ports: + - "8080:80" + volumes: + - ./src:/var/www/html + depends_on: + - db + networks: + - codebeater_net + + db: + image: mysql:8.0 + container_name: codebeater_mysql + command: --default-authentication-plugin=mysql_native_password + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: codebeater + MYSQL_USER: admin + MYSQL_PASSWORD: admin + volumes: + - db_codebeater:/var/lib/mysql + networks: + - codebeater_net + + phpmyadmin: + image: phpmyadmin/phpmyadmin:latest + container_name: codebeater_phpmyadmin + ports: + - "8081:80" + environment: + PMA_HOST: db + PMA_PORT: 3306 + depends_on: + - db + networks: + - codebeater_net + +volumes: + db_codebeater: + +networks: + codebeater_net: + driver: bridge diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 8a1ba96..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,53 +0,0 @@ -version: "3.8" - -services: - # --- PHP + Apache --- - web: - build: - context: . - dockerfile: web/Dockerfile - image: kelompok12:latest - container_name: phpapache - ports: - - "${APP_PORT}:80" - volumes: - - ./src:/var/www/html - environment: - - APACHE_RUN_USER=www-data - - APACHE_RUN_GROUP=www-data - depends_on: - - db - - # --- MySQL Database --- - db: - image: mysql:8.0 - platform: linux/amd64 - container_name: sql - restart: unless-stopped - environment: - MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} - MYSQL_DATABASE: ${MYSQL_DATABASE} - MYSQL_USER: ${MYSQL_USER} - MYSQL_PASSWORD: ${MYSQL_PASSWORD} - ports: - - "${MYSQL_PORT}:3306" - volumes: - - db_data:/var/lib/mysql - - # --- phpMyAdmin --- - phpmyadmin: - image: phpmyadmin/phpmyadmin:latest - platform: linux/amd64 - container_name: phpmyadmin - restart: unless-stopped - depends_on: - - db - environment: - PMA_HOST: db - PMA_USER: ${MYSQL_USER} - PMA_PASSWORD: ${MYSQL_PASSWORD} - ports: - - "${PHPMYADMIN_PORT}:80" - -volumes: - db_data: diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..a8f0b15 --- /dev/null +++ b/dockerfile @@ -0,0 +1,7 @@ +FROM php:8.2-apache + +RUN docker-php-ext-install mysqli + +COPY ./src /var/www/html + +EXPOSE 80 diff --git a/src/config/db.php b/src/config/db.php index e852f62..9e3bbf3 100644 --- a/src/config/db.php +++ b/src/config/db.php @@ -1,7 +1,7 @@ close(); login - - + +
diff --git a/web/Dockerfile b/web/Dockerfile deleted file mode 100644 index 7d849fb..0000000 --- a/web/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM php:8.1-apache - -# Install ekstensi PHP yang dibutuhkan -RUN apt-get update && apt-get install -y \ - libzip-dev zip unzip git \ - && docker-php-ext-install mysqli pdo pdo_mysql zip - -# Aktifkan mod_rewrite (penting untuk routing dan login) -RUN a2enmod rewrite - -# Copy source code (untuk development pakai volume) -COPY ./src/ /var/www/html/ - -# Ubah permission agar Apache bisa akses file -RUN chown -R www-data:www-data /var/www/html - -# Expose port 80 -EXPOSE 80