diff --git a/00_uebungs-files/01_docker-basics-php/Dockerfile b/00_uebungs-files/01_docker-basics-php/Dockerfile
new file mode 100644
index 0000000..3de95a7
--- /dev/null
+++ b/00_uebungs-files/01_docker-basics-php/Dockerfile
@@ -0,0 +1,18 @@
+FROM php:8.1-cli
+
+# GD Extension installieren
+RUN apt-get update && apt-get install -y \
+ libfreetype6-dev \
+ libjpeg62-turbo-dev \
+ libpng-dev \
+ && docker-php-ext-configure gd --with-freetype --with-jpeg \
+ && docker-php-ext-install -j$(nproc) gd
+
+# PDO MySQL Extension installieren
+RUN docker-php-ext-install pdo pdo_mysql
+
+WORKDIR /app
+COPY ./src .
+
+# Entwicklungsserver starten
+CMD ["php", "-S", "0.0.0.0:8000"]
diff --git a/00_uebungs-files/01_docker-basics-php/docker-compose.yml b/00_uebungs-files/01_docker-basics-php/docker-compose.yml
new file mode 100644
index 0000000..de89e9f
--- /dev/null
+++ b/00_uebungs-files/01_docker-basics-php/docker-compose.yml
@@ -0,0 +1,34 @@
+version: '3'
+
+services:
+ php-app:
+ build: .
+ ports:
+ - "8000:8000"
+ volumes:
+ - ./src:/app
+ environment:
+ DB_HOST: mysql-db
+ DB_USER: root
+ DB_PASSWORD: secret
+ DB_NAME: testdb
+ depends_on:
+ - mysql-db
+ networks:
+ - app-network
+
+ mysql-db:
+ image: mysql:8.0
+ environment:
+ MYSQL_ROOT_PASSWORD: secret
+ MYSQL_DATABASE: testdb
+ volumes:
+ - db-data:/var/lib/mysql
+ networks:
+ - app-network
+
+networks:
+ app-network:
+
+volumes:
+ db-data:
diff --git a/00_uebungs-files/01_docker-basics-php/src/db-test.php b/00_uebungs-files/01_docker-basics-php/src/db-test.php
new file mode 100644
index 0000000..9ea0bf8
--- /dev/null
+++ b/00_uebungs-files/01_docker-basics-php/src/db-test.php
@@ -0,0 +1,59 @@
+Datenbank-Verbindungstest";
+echo "
Verbindungsversuch zu: $host
";
+
+try {
+ // Verbindung erstellen
+ $conn = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
+
+ // PDO-Fehlerbehandlung aktivieren
+ $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+ echo "Verbindung erfolgreich!
";
+
+ // Prüfen, ob Testtabelle existiert, sonst erstellen
+ $stmt = $conn->query("SHOW TABLES LIKE 'test_table'");
+ if ($stmt->rowCount() == 0) {
+ $conn->exec("CREATE TABLE test_table (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ message VARCHAR(255),
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )");
+ $conn->exec("INSERT INTO test_table (message) VALUES ('Testdaten 1')");
+ $conn->exec("INSERT INTO test_table (message) VALUES ('Testdaten 2')");
+ echo "Testtabelle erstellt und mit Daten gefüllt.
";
+ }
+
+ // Daten auslesen
+ $stmt = $conn->query("SELECT * FROM test_table");
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ echo "Daten aus der Datenbank:
";
+ echo "";
+ echo "| ID | Nachricht | Erstellt am |
";
+
+ foreach ($rows as $row) {
+ echo "";
+ echo "| " . $row['id'] . " | ";
+ echo "" . $row['message'] . " | ";
+ echo "" . $row['created_at'] . " | ";
+ echo "
";
+ }
+
+ echo "
";
+
+} catch(PDOException $e) {
+ echo "Verbindungsfehler: " . $e->getMessage() . "
";
+}
+
+// Verbindung schließen
+$conn = null;
+?>
+
+Seite geladen um:
+Zurück zur Startseite
diff --git a/00_uebungs-files/01_docker-basics-php/src/image-test.php b/00_uebungs-files/01_docker-basics-php/src/image-test.php
new file mode 100644
index 0000000..b0a42ee
--- /dev/null
+++ b/00_uebungs-files/01_docker-basics-php/src/image-test.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+ PHP Docker Demo
+
+
+ PHP Docker Demo
+
+ PHP Info
+ PHP Version:
+
+ Tests
+
+
+ Diese Datei wurde geladen um:
+
+
diff --git a/00_uebungs-files/02_docker-basics-react/.dockerignore b/00_uebungs-files/02_docker-basics-react/.dockerignore
new file mode 100644
index 0000000..fa5cc20
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/.dockerignore
@@ -0,0 +1,7 @@
+node_modules
+npm-debug.log
+build
+.git
+.github
+.gitignore
+README.md
diff --git a/00_uebungs-files/02_docker-basics-react/Dockerfile b/00_uebungs-files/02_docker-basics-react/Dockerfile
new file mode 100644
index 0000000..06f3022
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/Dockerfile
@@ -0,0 +1,30 @@
+# Build-Stage
+FROM node:16 AS build
+
+WORKDIR /app
+
+# Abhängigkeiten zuerst kopieren und installieren (für besseres Caching)
+COPY package*.json ./
+RUN npm install
+
+# Den Rest der Anwendung kopieren
+COPY . .
+
+# Build-Zeit-Variable setzen
+RUN echo "REACT_APP_BUILD_TIME=$(date)" > .env
+
+# Anwendung bauen
+RUN npm run build
+
+# Production-Stage
+FROM nginx:alpine
+
+# Build-Output vom build-Stage kopieren
+COPY --from=build /app/build /usr/share/nginx/html
+
+# Nginx-Konfiguration (optional)
+# COPY nginx.conf /etc/nginx/conf.d/default.conf
+
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/00_uebungs-files/02_docker-basics-react/package.json b/00_uebungs-files/02_docker-basics-react/package.json
new file mode 100644
index 0000000..6a4b574
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "react-docker-demo",
+ "version": "0.1.0",
+ "private": true,
+ "dependencies": {
+ "react": "^18.2.0",
+ "react-dom": "^18.2.0"
+ },
+ "devDependencies": {
+ "react-scripts": "5.0.1"
+ },
+ "scripts": {
+ "start": "react-scripts start",
+ "build": "react-scripts build",
+ "test": "react-scripts test",
+ "eject": "react-scripts eject"
+ },
+ "browserslist": {
+ "production": [
+ ">0.2%",
+ "not dead",
+ "not op_mini all"
+ ],
+ "development": [
+ "last 1 chrome version",
+ "last 1 firefox version",
+ "last 1 safari version"
+ ]
+ }
+}
diff --git a/00_uebungs-files/02_docker-basics-react/public/index.html b/00_uebungs-files/02_docker-basics-react/public/index.html
new file mode 100644
index 0000000..4ea0a6e
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/public/index.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+ React Docker Demo
+
+
+
+
+
+
diff --git a/00_uebungs-files/02_docker-basics-react/src/App.css b/00_uebungs-files/02_docker-basics-react/src/App.css
new file mode 100644
index 0000000..874b819
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/src/App.css
@@ -0,0 +1,42 @@
+.App {
+ text-align: center;
+}
+
+.App-header {
+ background-color: #282c34;
+ min-height: 100vh;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ font-size: calc(10px + 2vmin);
+ color: white;
+}
+
+.counter {
+ margin: 2rem 0;
+ padding: 1rem;
+ background-color: rgba(255, 255, 255, 0.1);
+ border-radius: 8px;
+}
+
+button {
+ background-color: #61dafb;
+ border: none;
+ color: #282c34;
+ padding: 10px 20px;
+ font-size: 16px;
+ border-radius: 4px;
+ cursor: pointer;
+ font-weight: bold;
+}
+
+button:hover {
+ background-color: #4fa8c3;
+}
+
+.info {
+ margin-top: 2rem;
+ font-size: 0.8rem;
+ opacity: 0.7;
+}
diff --git a/00_uebungs-files/02_docker-basics-react/src/App.js b/00_uebungs-files/02_docker-basics-react/src/App.js
new file mode 100644
index 0000000..795f7b6
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/src/App.js
@@ -0,0 +1,28 @@
+import React, { useState } from 'react';
+import './App.css';
+
+function App() {
+ const [count, setCount] = useState(0);
+
+ return (
+
+
+ React Docker Demo
+ Diese App läuft in einem Docker-Container
+
+
+
Du hast den Button {count} mal geklickt
+
+
+
+
+ Build-Zeit: {process.env.REACT_APP_BUILD_TIME || 'Unbekannt'}
+
+
+
+ );
+}
+
+export default App;
diff --git a/00_uebungs-files/02_docker-basics-react/src/index.css b/00_uebungs-files/02_docker-basics-react/src/index.css
new file mode 100644
index 0000000..ec2585e
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/src/index.css
@@ -0,0 +1,13 @@
+body {
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
+ sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
+ monospace;
+}
diff --git a/00_uebungs-files/02_docker-basics-react/src/index.js b/00_uebungs-files/02_docker-basics-react/src/index.js
new file mode 100644
index 0000000..2cb1087
--- /dev/null
+++ b/00_uebungs-files/02_docker-basics-react/src/index.js
@@ -0,0 +1,11 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import './index.css';
+import App from './App';
+
+const root = ReactDOM.createRoot(document.getElementById('root'));
+root.render(
+
+
+
+);
diff --git a/00_uebungs-files/03_docker-compose/docker-compose.override.yml b/00_uebungs-files/03_docker-compose/docker-compose.override.yml
new file mode 100644
index 0000000..ebd735c
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker-compose.override.yml
@@ -0,0 +1,26 @@
+version: '3'
+
+services:
+ nginx:
+ ports:
+ - "8080:80"
+ volumes:
+ - ./src:/var/www/html:delegated
+ environment:
+ - NGINX_HOST=localhost
+ - NGINX_PORT=80
+
+ php:
+ build:
+ context: ./docker/php
+ dockerfile: Dockerfile.dev
+ volumes:
+ - ./src:/var/www/html:delegated
+ environment:
+ - PHP_IDE_CONFIG=serverName=docker
+ extra_hosts:
+ - "host.docker.internal:host-gateway"
+
+ db:
+ ports:
+ - "3306:3306"
diff --git a/00_uebungs-files/03_docker-compose/docker-compose.yml b/00_uebungs-files/03_docker-compose/docker-compose.yml
new file mode 100644
index 0000000..15e3246
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker-compose.yml
@@ -0,0 +1,50 @@
+version: '3'
+
+services:
+ nginx:
+ image: nginx:alpine
+ ports:
+ - "8000:80"
+ volumes:
+ - ./src:/var/www/html
+ - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
+ depends_on:
+ - php
+ networks:
+ - frontend
+ - backend
+
+ php:
+ build:
+ context: ./docker/php
+ dockerfile: Dockerfile
+ volumes:
+ - ./src:/var/www/html
+ environment:
+ - DB_HOST=db
+ - DB_USER=root
+ - DB_PASS=secret
+ - DB_NAME=testdb
+ networks:
+ - backend
+ depends_on:
+ - db
+
+ db:
+ image: mysql:8.0
+ command: --default-authentication-plugin=mysql_native_password
+ environment:
+ - MYSQL_ROOT_PASSWORD=secret
+ - MYSQL_DATABASE=testdb
+ volumes:
+ - db_data:/var/lib/mysql
+ networks:
+ - backend
+
+networks:
+ frontend:
+ backend:
+ internal: true
+
+volumes:
+ db_data:
diff --git a/00_uebungs-files/03_docker-compose/docker/nginx/default.conf b/00_uebungs-files/03_docker-compose/docker/nginx/default.conf
new file mode 100644
index 0000000..7955530
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker/nginx/default.conf
@@ -0,0 +1,17 @@
+server {
+ listen 80;
+ server_name localhost;
+ root /var/www/html;
+ index index.php index.html;
+
+ location / {
+ try_files $uri $uri/ /index.php?$query_string;
+ }
+
+ location ~ \.php$ {
+ fastcgi_pass php:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+}
diff --git a/00_uebungs-files/03_docker-compose/docker/php/Dockerfile b/00_uebungs-files/03_docker-compose/docker/php/Dockerfile
new file mode 100644
index 0000000..82e17fb
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker/php/Dockerfile
@@ -0,0 +1,27 @@
+FROM php:8.1-fpm
+
+# Abhängigkeiten installieren
+RUN apt-get update && apt-get install -y \
+ libfreetype6-dev \
+ libjpeg62-turbo-dev \
+ libpng-dev \
+ libzip-dev \
+ zip \
+ unzip
+
+# PHP Extensions installieren
+RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
+ && docker-php-ext-install -j$(nproc) \
+ gd \
+ pdo \
+ pdo_mysql \
+ zip
+
+# OPCache für Produktion aktivieren
+RUN docker-php-ext-install opcache \
+ && docker-php-ext-enable opcache
+
+WORKDIR /var/www/html
+
+# Produktionskonfiguration nutzen
+RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini
diff --git a/00_uebungs-files/03_docker-compose/docker/php/Dockerfile.dev b/00_uebungs-files/03_docker-compose/docker/php/Dockerfile.dev
new file mode 100644
index 0000000..a283021
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker/php/Dockerfile.dev
@@ -0,0 +1,30 @@
+FROM php:8.1-fpm
+
+# Abhängigkeiten installieren
+RUN apt-get update && apt-get install -y \
+ libfreetype6-dev \
+ libjpeg62-turbo-dev \
+ libpng-dev \
+ libzip-dev \
+ zip \
+ unzip
+
+# PHP Extensions installieren
+RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
+ && docker-php-ext-install -j$(nproc) \
+ gd \
+ pdo \
+ pdo_mysql \
+ zip
+
+# Development-Konfiguration nutzen
+RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
+
+# Xdebug installieren
+RUN pecl install xdebug \
+ && docker-php-ext-enable xdebug
+
+# Xdebug-Konfiguration kopieren
+COPY xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
+
+WORKDIR /var/www/html
diff --git a/00_uebungs-files/03_docker-compose/docker/php/xdebug.ini b/00_uebungs-files/03_docker-compose/docker/php/xdebug.ini
new file mode 100644
index 0000000..9dd712f
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/docker/php/xdebug.ini
@@ -0,0 +1,7 @@
+zend_extension=xdebug
+
+xdebug.mode=develop,debug
+xdebug.start_with_request=yes
+xdebug.client_host=host.docker.internal
+xdebug.client_port=9003
+xdebug.log=/var/log/xdebug.log
diff --git a/00_uebungs-files/03_docker-compose/src/db-test.php b/00_uebungs-files/03_docker-compose/src/db-test.php
new file mode 100644
index 0000000..e9e7ed3
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/src/db-test.php
@@ -0,0 +1,59 @@
+Datenbank-Verbindungstest";
+echo "Verbindungsversuch zu: $host
";
+
+try {
+ // Verbindung erstellen
+ $conn = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
+
+ // PDO-Fehlerbehandlung aktivieren
+ $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+ echo "Verbindung erfolgreich!
";
+
+ // Prüfen, ob Testtabelle existiert, sonst erstellen
+ $stmt = $conn->query("SHOW TABLES LIKE 'test_table'");
+ if ($stmt->rowCount() == 0) {
+ $conn->exec("CREATE TABLE test_table (
+ id INT AUTO_INCREMENT PRIMARY KEY,
+ message VARCHAR(255),
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ )");
+ $conn->exec("INSERT INTO test_table (message) VALUES ('Testdaten 1')");
+ $conn->exec("INSERT INTO test_table (message) VALUES ('Testdaten 2')");
+ echo "Testtabelle erstellt und mit Daten gefüllt.
";
+ }
+
+ // Daten auslesen
+ $stmt = $conn->query("SELECT * FROM test_table");
+ $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
+
+ echo "Daten aus der Datenbank:
";
+ echo "";
+ echo "| ID | Nachricht | Erstellt am |
";
+
+ foreach ($rows as $row) {
+ echo "";
+ echo "| " . $row['id'] . " | ";
+ echo "" . $row['message'] . " | ";
+ echo "" . $row['created_at'] . " | ";
+ echo "
";
+ }
+
+ echo "
";
+
+} catch(PDOException $e) {
+ echo "Verbindungsfehler: " . $e->getMessage() . "
";
+}
+
+// Verbindung schließen
+$conn = null;
+?>
+
+Seite geladen um:
+Zurück zur Startseite
diff --git a/00_uebungs-files/03_docker-compose/src/image-test.php b/00_uebungs-files/03_docker-compose/src/image-test.php
new file mode 100644
index 0000000..b0a42ee
--- /dev/null
+++ b/00_uebungs-files/03_docker-compose/src/image-test.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+ PHP Docker Demo
+
+
+
+ PHP-FPM mit Nginx Docker Demo
+
+
+
PHP Version:
+
Server Software:
+
Ausgeführt von:
+
Zeitstempel:
+
+
+ Extension Tests
+
+
+ Installierte PHP Extensions:
+
+
+
diff --git a/00_vortrags-files/Dockerfile b/00_vortrags-files/Dockerfile
new file mode 100644
index 0000000..4972fad
--- /dev/null
+++ b/00_vortrags-files/Dockerfile
@@ -0,0 +1,20 @@
+FROM php:8.1-fpm
+WORKDIR /var/www/html
+
+COPY composer.json ./
+
+RUN apt-get update && apt-get install -y \
+ zip \
+ unzip \
+ && docker-php-ext-install pdo pdo_mysql
+
+RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
+
+RUN composer install --no-scripts --no-autoloader
+
+COPY . .
+
+RUN composer dump-autoload --optimize
+
+EXPOSE 9000
+CMD ["php-fpm"]
diff --git a/00_vortrags-files/composer.json b/00_vortrags-files/composer.json
new file mode 100644
index 0000000..6431ec4
--- /dev/null
+++ b/00_vortrags-files/composer.json
@@ -0,0 +1,14 @@
+{
+ "name": "example/php-docker-demo",
+ "description": "Eine einfache PHP-Anwendung für Docker",
+ "type": "project",
+ "require": {
+ "php": ">=8.1",
+ "monolog/monolog": "^2.8"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "src/"
+ }
+ }
+}
diff --git a/00_vortrags-files/nginx.conf b/00_vortrags-files/nginx.conf
new file mode 100644
index 0000000..75dc8d7
--- /dev/null
+++ b/00_vortrags-files/nginx.conf
@@ -0,0 +1,29 @@
+worker_processes 1;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ include mime.types;
+ default_type application/octet-stream;
+
+ sendfile on;
+ keepalive_timeout 65;
+
+ server {
+ listen 9090;
+ server_name localhost;
+ root /var/www/html/public;
+ index index.php;
+
+ location ~ \.php$ {
+ fastcgi_pass 127.0.0.1:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+ }
+
+ include servers/*;
+}
diff --git a/00_vortrags-files/public/index.php b/00_vortrags-files/public/index.php
new file mode 100644
index 0000000..d7d4888
--- /dev/null
+++ b/00_vortrags-files/public/index.php
@@ -0,0 +1,51 @@
+pushHandler(new StreamHandler('php://stdout', Logger::INFO));
+
+$log->info('Anwendung gestartet');
+
+// HelloWorld-Klasse verwenden
+$hello = new HelloWorld();
+$message = $hello->getMessage();
+
+?>
+
+
+
+ Docker PHP Demo
+
+
+
+
+
PHP Docker Demo
+
Dies ist eine einfache PHP-Anwendung für Docker-Demo.
+
+
Status
+
+
+
PHP Info
+
PHP Version:
+
Loaded Extensions:
+
+
+
+
diff --git a/00_vortrags-files/src/HelloWorld.php b/00_vortrags-files/src/HelloWorld.php
new file mode 100644
index 0000000..fcfeb04
--- /dev/null
+++ b/00_vortrags-files/src/HelloWorld.php
@@ -0,0 +1,10 @@
+