diff --git a/podman/nginx/Containerfile b/podman/nginx/Containerfile new file mode 100644 index 0000000..437be36 --- /dev/null +++ b/podman/nginx/Containerfile @@ -0,0 +1,9 @@ +FROM docker.io/library/nginx:1.31.1-alpine + +# Kopiere die Konfiguration +COPY podman/nginx/default.conf /etc/nginx/conf.d/default.conf + +# Exponiere Port 80 (wird spΓ€ter im Pod gemappt) +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/podman/nginx/default.conf b/podman/nginx/default.conf new file mode 100644 index 0000000..a940ac2 --- /dev/null +++ b/podman/nginx/default.conf @@ -0,0 +1,25 @@ +server { + listen 80; + server_name localhost; + root /var/www/html/public; + + location / { + try_files $uri /index.php$is_args$args; + } + + location ~ ^/index\.php(/|$) { + fastcgi_pass localhost:9000; # PHP-FPM im selben Pod + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT $realpath_root; + internal; + } + + location ~ \.php$ { + return 404; + } + + error_log /var/log/nginx/project_error.log; + access_log /var/log/nginx/project_access.log; +} diff --git a/podman/php/Containerfile b/podman/php/Containerfile new file mode 100644 index 0000000..5343ab2 --- /dev/null +++ b/podman/php/Containerfile @@ -0,0 +1,30 @@ +FROM docker.io/library/php:8.5-fpm + +# Installiere System-AbhΓ€ngigkeiten +RUN apt-get update && apt-get install -y \ +# git \ + curl \ +# libpng-dev \ +# libonig-dev \ +# libxml2-dev \ +# zip \ +# unzip \ + apt-transport-https \ + gnupg \ +# && docker-php-ext-install pdo pdo_pgsql mbstring exif pcntl bcmath gd \ + && curl -1sLf 'https://dl.cloudsmith.io/public/symfony/stable/setup.deb.sh' | bash \ + && apt-get install -y symfony-cli \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Installiere Composer +COPY --from=docker.io/library/composer:2.10.0 /usr/bin/composer /usr/bin/composer + +# Arbeitsverzeichnis +WORKDIR /var/www/html + +# Benutzer fΓΌr Nicht-Root-Betrieb (optional, aber empfohlen) +# Wir nutzen hier den Standard www-data User von PHP-FPM +USER www-data + +CMD ["php-fpm"] diff --git a/setup-pod.sh b/setup-pod.sh new file mode 100755 index 0000000..51bb738 --- /dev/null +++ b/setup-pod.sh @@ -0,0 +1,110 @@ +#!/bin/bash + +# Konfiguration +POD_NAME="symfony-dev" +PROJECT_DIR="$(pwd)" +DB_PASSWORD="devpassword" # Γ„ndere dies! +DB_NAME="symfony_db" +DB_USER="symfony_user" +DB_HOST="localhost" +DB_PORT="5432" + +ENV_FILE="$PROJECT_DIR/.env" + +echo "πŸš€ Starte Symfony Pod Setup..." + +# 1. .env Datei automatisch erstellen/aktualisieren +echo "πŸ“ Konfiguriere .env Datei..." +DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=16&charset=utf8" + +if [ -f "$ENV_FILE" ]; then + # Datei existiert - DATABASE_URL aktualisieren oder hinzufΓΌgen + if grep -q "^DATABASE_URL=" "$ENV_FILE"; then + sed -i "s|^DATABASE_URL=.*|DATABASE_URL=\"$DATABASE_URL\"|" "$ENV_FILE" + echo " βœ… DATABASE_URL aktualisiert" + else + echo "DATABASE_URL=\"$DATABASE_URL\"" >> "$ENV_FILE" + echo " βœ… DATABASE_URL hinzugefΓΌgt" + fi + + # APP_ENV sicherstellen + if ! grep -q "^APP_ENV=" "$ENV_FILE"; then + echo "APP_ENV=dev" >> "$ENV_FILE" + echo " βœ… APP_ENV hinzugefΓΌgt" + fi +else + # Neue Datei erstellen + cat > "$ENV_FILE" <