From 933edbd0996860e655a7212a1b1ce76f4be5844d Mon Sep 17 00:00:00 2001 From: Hidayatullah Wildan Ghaly Buchary <16521502@std.stei.itb.ac.id> Date: Sat, 30 Sep 2023 14:48:11 +0700 Subject: [PATCH] feat: set up docker --- .htaccess | 2 -- db/mahasiswa_leveling.sql | 70 +++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 25 ++++++++++++-- index.php | 1 + 4 files changed, 93 insertions(+), 5 deletions(-) delete mode 100644 .htaccess create mode 100644 db/mahasiswa_leveling.sql create mode 100644 index.php diff --git a/.htaccess b/.htaccess deleted file mode 100644 index b6e583e..0000000 --- a/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -RewriteEngine On -RewriteRule ^$ app/views/landing [L] \ No newline at end of file diff --git a/db/mahasiswa_leveling.sql b/db/mahasiswa_leveling.sql new file mode 100644 index 0000000..0c0f47b --- /dev/null +++ b/db/mahasiswa_leveling.sql @@ -0,0 +1,70 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.1 +-- https://www.phpmyadmin.net/ +-- +-- Host: db:3306 +-- Generation Time: Sep 30, 2023 at 07:40 AM +-- Server version: 8.1.0 +-- PHP Version: 8.2.8 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Database: `mahasiswa_leveling` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +CREATE TABLE `users` ( + `id` int NOT NULL, + `username` varchar(255) NOT NULL, + `email` varchar(255) NOT NULL, + `password` varchar(255) NOT NULL, + `isAdmin` tinyint(1) NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; + +-- +-- Dumping data for table `users` +-- + +INSERT INTO `users` (`id`, `username`, `email`, `password`, `isAdmin`) VALUES +(1, 'admin', 'admin@gmail.com', 'admin', 1), +(2, 'user', 'user@gmail.com', 'user', 0); + +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `users` +-- +ALTER TABLE `users` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `username` (`username`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `users` +-- +ALTER TABLE `users` + MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/docker-compose.yml b/docker-compose.yml index 7c5e0ae..afc719e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,25 @@ version: '3.3' services: - web: - image: tubes-1:latest + www: + image: php:8.0-apache + volumes: + - "./:/var/www/html" # sync project dir with container ports: - - 8008:80 + - 8080:80 + - 443:443 + db: + image: mysql:latest + environment: + - MYSQL_DATABASE=mahasiswa_leveling + - MYSQL_USER=zero_one + - MYSQL_PASSWORD=password # this should live in a env var + - MYSQL_ALLOW_EMPTY_PASSWORD=1 # equivalent to True + volumes: + - "./db:/docker-entrypoint-initdb.d" # sync persistent sql files with container + phpmyadmin: + image: phpmyadmin/phpmyadmin + ports: + - 8001:80 + environment: + - PMA_HOST=db + - PMA_PORT=3306 \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..a054d22 --- /dev/null +++ b/index.php @@ -0,0 +1 @@ +<meta http-equiv="refresh" content="0;url=app/views/landing"> \ No newline at end of file -- GitLab