Add docker compose, add db setup, add webserver dockerfile
This commit is contained in:
parent
b018861b55
commit
f2619aeb2c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
|
||||
dbConnect.php
|
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM php:7.0-apache
|
||||
|
||||
RUN apt-get update
|
||||
RUN docker-php-ext-install pdo pdo_mysql mysqli
|
||||
RUN a2enmod rewrite
|
@ -3,10 +3,10 @@
|
||||
//Create DB connection.
|
||||
//This creates a usable "database" - Variable as mysqli Objekt
|
||||
//simply remove the "~" in front of the filename
|
||||
$user = 'user';
|
||||
$password = 'password';
|
||||
$db = 'database name';
|
||||
$host = 'ip or domain';
|
||||
$user = 'root';
|
||||
$password = 'Test';
|
||||
$db = 'kd42696_ipr-projekt';
|
||||
$host = 'db';
|
||||
$port = 3306;
|
||||
|
||||
$database = new mysqli($host, $user, $password, $db, $port);
|
29
docker-compose.yml
Normal file
29
docker-compose.yml
Normal file
@ -0,0 +1,29 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
db:
|
||||
build:
|
||||
context: ./sql
|
||||
ports:
|
||||
- "5455:3306"
|
||||
volumes:
|
||||
- "db-data:/var/lib/mysql"
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: "Test"
|
||||
|
||||
webserver:
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- "./:/var/www/html"
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
|
||||
|
||||
# docker run -d -p 5455:3306 -v `pwd`/setup:/docker-entrypoint-initdb.d/ -v `pwd`/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Test mariadb
|
||||
# docker run -d -p 80:80 --name my-apache-php-app -v `pwd`:/var/www/html php:7.0-apache
|
@ -1,2 +1,2 @@
|
||||
FROM mariadb
|
||||
COPY ./sql-dump.sql /docker-entrypoint-initdb.d/
|
||||
COPY ./sample-db.sql /docker-entrypoint-initdb.d/
|
||||
|
@ -1 +0,0 @@
|
||||
docker run -d -p 5455:3306 -v `pwd`/setup:/docker-entrypoint-initdb.d/ -v `pwd`/mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Test mariadb
|
Loading…
Reference in New Issue
Block a user