container and dev preparations
Some checks failed
ci / docker (push) Failing after 11m20s

This commit is contained in:
Chris 2025-06-10 10:39:47 +02:00
parent fbe7613f97
commit 469ef7f5ea
7 changed files with 48 additions and 17 deletions

View File

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

18
docker-compose-dev.yml Normal file
View File

@ -0,0 +1,18 @@
version: '3.3'
services:
http2pic:
build:
context: .
dockerfile: docker/Dockerfile
restart: unless-stopped
volumes:
- ./cache:/srv/cache
- ./src:/srv/src
- ./web:/srv/web
- ./logs:/srv/logs
environment:
- URL=http://localhost:8080
ports:
- 8080:80

5
docker/Caddyfile Normal file → Executable file
View File

@ -3,5 +3,10 @@
php_fastcgi 127.0.0.1:9000 php_fastcgi 127.0.0.1:9000
file_server file_server
log {
output file /srv/logs/web.error.log
level ERROR
}
try_files {path} {path}/ /index.php?{query} try_files {path} {path}/ /index.php?{query}
} }

12
docker/Dockerfile Normal file → Executable file
View File

@ -1,14 +1,16 @@
FROM alpine:3.21 FROM alpine:3.21
# Install PHP and necessary extensions # Install PHP and necessary extensions
RUN apk add --no-cache curl php83 php83-fpm php83-opcache caddy php83-curl php83-xdebug chromium-chromedriver RUN apk add --no-cache curl php84 php84-fpm php84-opcache caddy php84-curl php84-xdebug chromium-chromedriver
RUN sed -i 's/nobody/caddy/g' /etc/php83/php-fpm.d/www.conf RUN sed -i 's/nobody/caddy/g' /etc/php84/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 RUN sed -i 's/E_ALL \& ~E_DEPRECATED \& ~E_STRICT/E_ALL \& ~E_DEPRECATED \& ~E_STRICT \& ~E_NOTICE \& ~E_WARNING/g' /etc/php84/php.ini
# log php errors to /srv/logs/php_errors.log
RUN echo "error_log = /srv/logs/php_errors.log" >> /etc/php84/php.ini
# Install additional PHP extensions # Install additional PHP extensions
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 apk add --no-cache php84-ctype php84-dom php84-fileinfo php84-gd php84-iconv php84-simplexml php84-xml php84-xmlreader php84-xmlwriter php84-zip php84-phar php84-openssl
RUN curl -sS https://getcomposer.org/installer | /usr/bin/php83 -- --install-dir=/usr/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | /usr/bin/php84 -- --install-dir=/usr/bin --filename=composer
ADD docker/start.sh /start.sh ADD docker/start.sh /start.sh
RUN chmod +x /start.sh RUN chmod +x /start.sh

2
docker/start.sh Normal file → Executable file
View File

@ -1,6 +1,6 @@
echo ' [+] Starting php' echo ' [+] Starting php'
php-fpm83 php-fpm84
cd /srv/src cd /srv/src
composer install composer install

0
logs/.gitignore vendored Normal file → Executable file
View File

View File

@ -23,6 +23,12 @@ switch($url[0])
$target = substr($_SERVER['REQUEST_URI'],5); $target = substr($_SERVER['REQUEST_URI'],5);
if(!$target || !filter_var($target, FILTER_VALIDATE_URL)) if(!$target || !filter_var($target, FILTER_VALIDATE_URL))
$target = $_REQUEST['url']; $target = $_REQUEST['url'];
if(!filter_var($target, FILTER_VALIDATE_URL))
{
header('HTTP/1.0 400 Bad Request');
echo 'Invalid URL';
exit;
}
$viewport = $_REQUEST['viewport']; $viewport = $_REQUEST['viewport'];
$js = $_REQUEST['js']=='false'?false:true; $js = $_REQUEST['js']=='false'?false:true;