mirror of
https://github.com/zebrajr/LAMPinDocker.git
synced 2025-12-06 00:20:22 +01:00
Test bench uploaded
This commit is contained in:
parent
d75882e91a
commit
6b7538580c
2
Dockerfile
Normal file
2
Dockerfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
FROM php:8.0.7-apache
|
||||
RUN docker-php-ext-install mysqli pdo pdo_mysql
|
||||
33
docker-compose.yml
Normal file
33
docker-compose.yml
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
version: "3.7"
|
||||
services:
|
||||
web-server:
|
||||
container_name: webServerBench
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- "./html/:/var/www/html/"
|
||||
ports:
|
||||
- "1237:80"
|
||||
|
||||
|
||||
mysql-server:
|
||||
container_name: mySqlBench
|
||||
image: mysql:8.0.19
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: secret
|
||||
volumes:
|
||||
- "./mySql/:/var/lib/mysql"
|
||||
|
||||
phpmyadmin:
|
||||
container_name: phpMyAdminBench
|
||||
image: phpmyadmin/phpmyadmin:5.0.1
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PMA_HOST: mysql-server
|
||||
PMA_USER: root
|
||||
PMA_PASSWORD: secret
|
||||
ports:
|
||||
- "1238:80"
|
||||
14
html/index.php
Normal file
14
html/index.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
$host = "keytechMySQL";
|
||||
$user = "root";
|
||||
$pass = "secret";
|
||||
$db = "database1";
|
||||
try {
|
||||
$conn = new PDO("mysql:host=$host;dbname=$db", $user, $pass);
|
||||
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
echo "Connected successfully";
|
||||
} catch(PDOException $e) {
|
||||
echo "Connection failed: " . $e->getMessage();
|
||||
}
|
||||
?>
|
||||
0
mySql/placeholder
Normal file
0
mySql/placeholder
Normal file
Loading…
Reference in New Issue
Block a user