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

View File

@@ -1,34 +0,0 @@
param(
[string]$compressedFile
)
# Load .NET assembly for file handling
Add-Type -AssemblyName System.IO.Compression.FileSystem
# Resolve absolute path of the compressed file
$absoluteCompressedFile = Resolve-Path $compressedFile
# Generate file names
$workingDir = Split-Path $absoluteCompressedFile
$uncompressedFile = Join-Path $workingDir ($compressedFile -replace '^\.\\', '' -replace '\.sql\.gz$', '_uncompressed.sql')
$modifiedFile = Join-Path $workingDir ($compressedFile -replace '^\.\\', '' -replace '\.sql\.gz$', '_modified.sql')
$recompressedFile = Join-Path $workingDir ($compressedFile -replace '^\.\\', '' -replace '\.gz$', '_modified.sql.gz')
# Decompress .sql.gz file using .NET Framework
[System.IO.Compression.ZipFile]::ExtractToDirectory($absoluteCompressedFile, $workingDir)
# Read content of uncompressed file
$content = Get-Content -Path $uncompressedFile -Raw
# Replace text
$content = $content -replace 'utf8mb4_0900_ai_ci', 'utf8mb4_general_ci'
# Write modified content to file
Set-Content -Path $modifiedFile -Value $content -Encoding UTF8
# Compress .sql file back to .sql.gz using .NET Framework
[System.IO.Compression.ZipFile]::CreateFromDirectory($workingDir, $recompressedFile)
# Cleanup: Optionally, you can remove the uncompressed and modified files if you don't need them anymore
# Remove-Item $uncompressedFile
# Remove-Item $modifiedFile

View File

@@ -1,21 +0,0 @@
param(
[string]$compressedFile
)
# Generate file names
$uncompressedFile = $compressedFile -replace '\.sql\.gz$', '_uncompressed.sql'
$modifiedFile = $compressedFile -replace '\.sql\.gz$', '_modified.sql'
$recompressedFile = $compressedFile -replace '\.gz$', '_modified.sql.gz'
# Decompress .sql.gz file using 7-Zip
& "C:\Program Files\7-Zip\7z.exe" x -so $compressedFile | Set-Content -Path $uncompressedFile -Encoding UTF8
# Replace text using PowerShell
(Get-Content $uncompressedFile) -replace "utf8mb4_0900_ai_ci", "utf8mb4_general_ci" | Set-Content $modifiedFile -Encoding UTF8
# Compress .sql file back to .sql.gz using 7-Zip
& "C:\Program Files\7-Zip\7z.exe" a -tgzip $recompressedFile $modifiedFile
# Cleanup: Optionally, you can remove the uncompressed and modified files if you don't need them anymore
#Remove-Item $uncompressedFile
#Remove-Item $modifiedFile

View File

@@ -1,3 +0,0 @@
post_max_size = 516M
upload_max_filesize = 516M
memory_limit = 2G

3
docker/adminer/php.ini Normal file
View File

@@ -0,0 +1,3 @@
post_max_size = 2048M
upload_max_filesize = 2048M
memory_limit = 8G

View File

@@ -1,31 +0,0 @@
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
allowoverride all
</Directory>
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>

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"]

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 $!