dockerized the application for easier distribution and depleyment
This commit is contained in:
parent
b06c3cec3e
commit
a9147c3698
6 changed files with 100 additions and 28 deletions
2
Dockerfile.db
Normal file
2
Dockerfile.db
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
FROM mariadb
|
||||
COPY ./MatheApp.sql /docker-entrypoint-initdb.d/
|
||||
18
Dockerfile.math_wizard
Normal file
18
Dockerfile.math_wizard
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Verwende ein Basisimage mit PHP
|
||||
FROM php:8.2-cli
|
||||
|
||||
# Setze das Arbeitsverzeichnis
|
||||
WORKDIR /app
|
||||
|
||||
# Kopiere den Projektinhalt in das Arbeitsverzeichnis im Container
|
||||
COPY . .
|
||||
|
||||
# Installiere die erforderlichen PHP-Erweiterungen
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
# Exponiere den Port, den der PHP-Server verwenden wird
|
||||
EXPOSE 8080
|
||||
|
||||
# Starte den PHP-Server beim Containerstart
|
||||
CMD ["php", "-S", "0.0.0.0:8080"]
|
||||
|
||||
11
MatheApp.sql
11
MatheApp.sql
|
|
@ -48,14 +48,3 @@ LOCK TABLES `user` WRITE;
|
|||
INSERT INTO `user` VALUES (3,'patryk','patryk','hegenberg','testMail@test.de','$2y$10$G8s3UA8zMjHnKAQ01B4.R.NX7gLZi28BuQiOVyBbnbYbNCZusx13W',1,3,110,566,NULL),(16,'admin','','','admin@themathwizard.de','$2y$10$M8DKsBn2KA49XCzdUzVY4.hciLBOzgzB94z3YR4hNyNgvwNlnXiyO',0,1,0,0,1);
|
||||
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!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 */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2023-01-24 21:17:03
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
return [
|
||||
'database' => [
|
||||
'host' => 'localhost',
|
||||
'host' => 'db',
|
||||
'port' => 3306,
|
||||
'dbname' => 'MatheApp',
|
||||
'charset' => 'utf8mb4'
|
||||
|
|
|
|||
46
docker-compose.yml
Normal file
46
docker-compose.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
web:
|
||||
#image: math_wizard
|
||||
build:
|
||||
context: /home/pata/dev/WebProg/TheMathWizard
|
||||
dockerfile: Dockerfile.math_wizard
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- mathwizard-network
|
||||
|
||||
db:
|
||||
build:
|
||||
context: /home/pata/dev/WebProg/TheMathWizard
|
||||
dockerfile: Dockerfile.db
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: MatheApp
|
||||
MYSQL_USER: MatheApp
|
||||
MYSQL_PASSWORD: password
|
||||
volumes:
|
||||
- ./math_wizard_db_data:/var/lib/mysql
|
||||
networks:
|
||||
- mathwizard-network
|
||||
|
||||
nginx:
|
||||
image: nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
volumes:
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
depends_on:
|
||||
- web
|
||||
networks:
|
||||
- mathwizard-network
|
||||
|
||||
volumes:
|
||||
math_wizard_db_data:
|
||||
|
||||
networks:
|
||||
mathwizard-network:
|
||||
driver: bridge
|
||||
17
nginx.conf
Normal file
17
nginx.conf
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
events {}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
server_name math-wizard;
|
||||
|
||||
location / {
|
||||
proxy_pass http://web:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue