# Use an official PHP runtime
FROM php:8.2-apache
# Prepare apt
RUN apt update
# Prepare fake ssl certifikat
RUN apt install -y curl sqlite3 ssl-cert php-fpm php-sqlite3
# Setup Apache2 mod_ssl
RUN a2enmod ssl
# Setup Apache2 LINK HTTPS 
RUN a2ensite default-ssl.conf
# Enable Apache modules
RUN a2enmod rewrite
RUN a2enmod proxy_fcgi setenvif
RUN a2enconf php8.2-fpm
RUN a2enmod headers
# dpkg 
RUN dpkg-reconfigure tzdata
RUN dpkg-reconfigure locales
# Install any extensions you need
RUN docker-php-ext-install mysqli pdo pdo_mysql pdo_sqlite
# Set the working directory to /var/www/html/public
WORKDIR /var/www/html/public
# Copy the source code in /www into the container at /var/www/html
COPY ../www .
# Verzeichniss Rechte setzen
RUN chmod -R 777 /var/www/html
RUN chown -R www-data:www-data /var/www/html
RUN curl --request GET --url http://localhost/api/setup --header "Content-Type: application/x-www-form-urlencoded"
