Add dockerfile and update config file

This commit is contained in:
muthianura
2026-06-11 18:56:34 +07:00
parent f104007f77
commit c66457e587
9 changed files with 83 additions and 19 deletions
+12
View File
@@ -0,0 +1,12 @@
FROM php:8.2-apache
RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli
RUN a2enmod rewrite
COPY . /var/www/html/
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 755 /var/www/html
EXPOSE 80
+11
View File
@@ -0,0 +1,11 @@
<?php
define('DB_HOST', getenv('DB_HOST'));
define('DB_USER', getenv('DB_USER'));
define('DB_PASS', getenv('DB_PASS'));
define('DB_NAME', getenv('DB_NAME'));
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
die("Koneksi gagal: " . $conn->connect_error);
}
?>
+1 -5
View File
@@ -1,7 +1,3 @@
<?php
$conn = new mysqli("localhost", "root", "", "webgis");
if ($conn->connect_error) {
die("Koneksi gagal: " . $conn->connect_error);
}
require_once 'config.php';
?>