initial commit

master
sephger 2024-02-11 13:27:43 +01:00
commit 01d61c602f
4 changed files with 93 additions and 0 deletions

43
docker-compose.yml 100644
View File

@ -0,0 +1,43 @@
version: '3.5'
name: webstack
# Services
services:
# PHP FPM Service
php:
container_name: php
build:
dockerfile: php-dockerfile
context: .
volumes:
- 'webdata:/var/www/html'
- './php-logging.conf:/usr/local/etc/php-fpm.d/zz-log.conf'
depends_on:
- mariadb
# Nginx Service
nginx:
container_name: web
image: nginx:latest
links:
- 'php'
volumes:
- 'webdata:/var/www/html'
- './nginx-conf:/etc/nginx/conf.d'
depends_on:
- php
# MariaDB Service
mariadb:
container_name: db
image: mariadb:10.9
environment:
MYSQL_ROOT_PASSWORD: $MYSQLPASS
volumes:
- 'mysqldata:/var/lib/mysql'
# Volumes
volumes:
mysqldata:
webdata:

View File

@ -0,0 +1,30 @@
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/html/web;
index index.php index.html;
# Support Yii2 pretty URL routing
location / {
try_files $uri $uri/ =404;
if (!-e $request_filename){
rewrite ^/(.*) /index.php?r=$1 last;
}
}
location ~* \.php$ {
fastcgi_pass php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
# Prevent additional headers like TRACE, DELETE, PUSH
if ($request_method !~ ^(GET|HEAD|POST)$ )
{
return 405;
}
}

18
php-dockerfile 100644
View File

@ -0,0 +1,18 @@
FROM php:8.1-fpm
# Installing dependencies for the PHP modules
RUN apt-get update && \
apt-get install -y zip curl libcurl3-dev libzip-dev libpng-dev libonig-dev libxml2-dev
# libonig-dev is needed for oniguruma which is needed for mbstring
# Installing additional PHP modules
RUN docker-php-ext-install curl gd mbstring mysqli pdo pdo_mysql xml
# Install and configure ImageMagick
RUN apt-get install -y libmagickwand-dev
RUN pecl install imagick
RUN docker-php-ext-enable imagick
RUN apt-get purge -y libmagickwand-dev
# Install Composer so it's available
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

2
php-logging.conf 100644
View File

@ -0,0 +1,2 @@
php_admin_flag[log_errors] = on
php_flag[display_errors] = off