preparations and testing for a rewrite, ditching wkhtmltopdf for chrome-driver

This commit is contained in:
2025-01-12 20:13:47 +00:00
parent cf07363a8d
commit f54d35c312
18 changed files with 516 additions and 77 deletions

7
.devcontainer/Caddyfile Normal file
View File

@ -0,0 +1,7 @@
:8080 {
root * xxxxxxxxxx
php_fastcgi 127.0.0.1:9000
file_server
try_files {path} {path}/ /index.php?{query}
}

23
.devcontainer/Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM alpine:3.21
RUN apk add --no-cache git curl php83 php83-fpm php83-opcache caddy php83-curl php83-xdebug chromium-chromedriver
ADD .devcontainer/start.sh /start.sh
RUN chmod +x /start.sh
RUN apk add --no-cache php83-ctype php83-dom php83-fileinfo php83-gd php83-iconv php83-simplexml php83-xml php83-xmlreader php83-xmlwriter php83-zip php83-phar php83-openssl
RUN curl -sS https://getcomposer.org/installer | /usr/bin/php83 -- --install-dir=/usr/bin --filename=composer
# caddy stuff
ADD .devcontainer/Caddyfile /etc/caddy/Caddyfile
RUN sed -i 's/nobody/caddy/g' /etc/php83/php-fpm.d/www.conf
RUN sed -i 's/E_ALL \& ~E_DEPRECATED \& ~E_STRICT/E_ALL \& ~E_DEPRECATED \& ~E_STRICT \& ~E_NOTICE \& ~E_WARNING/g' /etc/php83/php.ini
# configure xdebug
RUN echo "zend_extension=xdebug.so" > /etc/php83/conf.d/xdebug.ini
RUN echo "xdebug.mode=debug" >> /etc/php83/conf.d/xdebug.ini
RUN echo "xdebug.start_with_request=yes" >> /etc/php83/conf.d/xdebug.ini
RUN echo "xdebug.client_host=127.0.0.1" >> /etc/php83/conf.d/xdebug.ini
RUN echo "xdebug.client_port=9003" >> /etc/php83/conf.d/xdebug.ini
RUN echo "xdebug.idekey=VSCODE" >> /etc/php83/conf.d/xdebug.ini

View File

@ -0,0 +1,35 @@
{
"name": "Web Project Dev Container",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"forwardPorts": [8080],
"postCreateCommand": "/start.sh",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.shell.linux": "/bin/ash",
"php.validate.executablePath": "/usr/bin/php",
"php.debug.listenPort": 9003,
"php.debug.log": true
},
"extensions": [
"ms-azuretools.vscode-docker",
"felixfbecker.php-debug",
"bmewburn.vscode-intelephense-client",
"otovo-oss.htmx-tags",
"devsense.phptools-vscode",
"bmewburn.vscode-intelephense-client",
"github.copilot",
"github.copilot-chat",
"anbuselvanrocky.bootstrap5-vscode",
"hansuxdev.bootstrap5-snippets",
"alefragnani.Bookmarks",
"eamodio.gitlens"
]
}
},
"remoteUser": "root"
}

23
.devcontainer/start.sh Normal file
View File

@ -0,0 +1,23 @@
WORKSPACE_PATH=$( pwd )
# Escape the path for safe use in sed
ESCAPED_PATH=$(echo "$WORKSPACE_PATH" | sed 's/\//\\\//g')
echo "[!] Folder is $WORKSPACE_PATH"
echo ' [+] Starting php'
php-fpm83
echo ' [+] Starting Caddy'
sed -i "s|xxxxxxxxxx|$ESCAPED_PATH\/web|g" /etc/caddy/Caddyfile
cd ${WORKSPACE_PATH}/src
composer install
echo ' [+] Starting Chrome'
chromedriver --port=4444 &
chmod 777 ${WORKSPACE_PATH}/cache
chmod 777 ${WORKSPACE_PATH}/logs
caddy run --config /etc/caddy/Caddyfile