---
# PHP Installation und Konfiguration

- name: Stelle sicher, dass das PHP-Docker-Verzeichnis existiert
  file:
    path: "{{ deploy_root }}/docker/php"
    state: directory
    owner: "{{ deploy_user }}"
    group: "{{ deploy_user }}"
    mode: '0755'

- name: Erstelle einfache PHP-Dockerfile
  copy:
    dest: "{{ deploy_root }}/docker/php/Dockerfile-simple"
    content: |
      FROM php:8.1-fpm

      RUN apt-get update && apt-get install -y \
          git \
          unzip \
          libzip-dev \
          zip \
          && docker-php-ext-install zip pdo pdo_mysql \
          && docker-php-ext-install opcache \
          && apt-get clean \
          && rm -rf /var/lib/apt/lists/*

      WORKDIR /var/www/html

      CMD ["php-fpm"]
    owner: "{{ deploy_user }}"
    group: "{{ deploy_user }}"
    mode: '0644'
