Docker image integration (beta)

This commit is contained in:
2025-10-01 15:42:34 +02:00
parent 906beaaa4b
commit c619b748fa
4 changed files with 49 additions and 0 deletions

10
Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM php:8.2-apache
RUN docker-php-ext-install mysqli pdo pdo_mysql
COPY htdocs/ /var/www/html/
COPY docker/php/db.php /var/www/html/db.php
RUN chown -R www-data:www-data /var/www/html
# For now remove OpenID files from container, OpenID integration will come soon.
RUN rm /var/www/html/admin/login.php.keycloak
RUN rm /var/www/html/admin/logout.php.keycloak
RUN a2enmod rewrite
EXPOSE 80

27
docker-compose.yml Normal file
View File

@@ -0,0 +1,27 @@
version: "3.8"
services:
web:
build: .
container_name: orario-web
ports:
- "8080:80"
depends_on:
- db
restart: unless-stopped
db:
image: mariadb:11
container_name: orario-db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: P@ssw0rd
MYSQL_DATABASE: school_timetable
MYSQL_USER: orario
MYSQL_PASSWORD: orario
volumes:
- db_data:/var/lib/mysql
- ./schema.sql:/docker-entrypoint-initdb.d/init.sql:ro
volumes:
db_data:

11
docker/php/db.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
$host = "db";
$user = "orario";
$pass = "orario";
$dbname = "school_timetable";
$conn = new mysqli($host, $user, $pass, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

1
docker/readme.txt Normal file
View File

@@ -0,0 +1 @@
These files are used by docker compose builder to create a working image in one command.