reworked docker setup

This commit is contained in:
Luca Haid
2024-05-08 21:07:07 +02:00
parent 2667f2fb59
commit d8300bfdb5
9 changed files with 20 additions and 112 deletions

21
docker/php/Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# Use Debian Bookworm as base image
FROM debian:bookworm
# Install apache2 and PHP and PHP modules
RUN apt update && \
apt install -y apache2 curl unzip php8.2 php8.2-curl php8.2-cli php8.2-mysqli php8.2-gd php8.2-zip php8.2-dom php8.2-mbstring && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Enable PHP in Apache2
RUN a2enmod php8.2
RUN a2enmod rewrite
# Composer install
WORKDIR /var/www/html
COPY ../../composer.json ./
RUN composer install --no-interaction
# Start Apache in the foreground
CMD ["apachectl", "-D", "FOREGROUND"]

9
docker/php/apache.conf Normal file
View File

@@ -0,0 +1,9 @@
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
AllowOverride All
</Directory>
</VirtualHost>

5
docker/php/entrypoint.sh Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
trap "echo 'Stopping Apache...'; apachectl stop; exit 0" SIGTERM
apachectl -D FOREGROUND &
# Wait for Apache and all child processes to exit
wait $!