fix: fixed bug css cache at browser and fixing named container docker

This commit is contained in:
Matthew Florentino 2025-11-24 10:15:04 +07:00
parent 2e1bb8c477
commit 6b62df95f0
8 changed files with 117 additions and 77 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
.env
.docs.txt

50
docker-compose.yaml Normal file
View File

@ -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

View File

@ -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:

7
dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM php:8.2-apache
RUN docker-php-ext-install mysqli
COPY ./src /var/www/html
EXPOSE 80

View File

@ -1,7 +1,7 @@
<?php <?php
$hostname = "db"; $hostname = "db";
$username = "user"; $username = "admin";
$password = "user"; $password = "admin";
$database = "codebeater"; $database = "codebeater";
$db = mysqli_connect($hostname, $username, $password, $database); $db = mysqli_connect($hostname, $username, $password, $database);

View File

@ -6,6 +6,62 @@
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.container-login h1 { .container-login h1 {
font-size: 100px; font-size: 100px;
}
.container-login form {
text-align: center;
padding: 30px;
}
.container-login form h2 {
margin-bottom: 20px;
font-size: 30px;
text-transform: capitalize;
}
.container-login form input {
margin-bottom: 10px;
width: 200px;
height: 30px;
border-radius: 6px;
text-align: center;
background-color: black;
border: 1px solid white;
color: white;
}
.container-login form input::placeholder {
color: #919191;
}
.container-login form button {
border-radius: 6px;
width: 200px;
height: 30px;
margin-top: 40px;
font-size: 30px
}
.container-login form button:hover {
border-radius: 6px;
width: 200px;
height: 30px;
margin-top: 40px;
font-size: 30px;
}
.container-login form p {
margin-top: 10px;
}
.container-login form p a {
color: white;
text-decoration: none;
}
.container-login form p a span {
color: yellow;
} }

View File

@ -42,8 +42,8 @@ $db->close();
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login</title> <title>login</title>
<link rel="stylesheet" href="../css/global.css"> <link rel="stylesheet" href="/css/global.css">
<link rel="stylesheet" href="../css/style.css"> <link rel="stylesheet" href="/css/style.css">
</head> </head>
<body> <body>
<div class="container-login"> <div class="container-login">

View File

@ -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