diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..8f11002 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +.git +.gitignore +.dockerignore +Dockerfile +img/gallery/backup_orig/ +img/logo_dialysezentrum_orig.png +files/flyer_template.html +files/flyer_map.png + diff --git a/Dockerfile b/Dockerfile index 2d8401f..d9797f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,24 @@ -FROM php:8.5-apache - -# Install common extensions (example) -# RUN docker-php-ext-install - -# Enable Apache modules if needed -RUN a2enmod rewrite - -# Copy application code -COPY . /var/www/html/ - -# Disable the legacy HTTPS redirect rules from .htaccess so the container stays on plain HTTP -# RUN sed -i '/RewriteCond %{HTTP_HOST} !^www\\.dialyse-berlin\\.net \[NC\]/,+2d; /RewriteCond %{HTTP_HOST} ^www\\.dialyse-berlin\\.net \[NC\]/,+2d' /var/www/html/.htaccess || true \ -# && a2dismod ssl || true - -# Set permissions -RUN chown -R www-data:www-data /var/www/html - -# Optional: install Composer dependencies if you have a composer.json -# COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -# RUN composer install --no-dev --optimize-autoloader - -EXPOSE 80 \ No newline at end of file +FROM php:8.5-apache-trixie + +# Install system dependencies and PHP GD extension (with FreeType & JPEG/PNG support) +RUN apt-get update && apt-get install -y --no-install-recommends \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j"$(nproc)" gd \ + && rm -rf /var/lib/apt/lists/* + +# Use official production php.ini and configure timezone & security settings +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && printf "date.timezone = Europe/Berlin\nexpose_php = Off\nsession.cookie_httponly = 1\nsession.use_strict_mode = 1\n" > "$PHP_INI_DIR/conf.d/99-custom.ini" + +# Enable Apache modules and harden server signature +RUN a2enmod rewrite headers expires deflate \ + && printf "ServerTokens Prod\nServerSignature Off\n" > /etc/apache2/conf-available/security-hardening.conf \ + && a2enconf security-hardening + +# Copy application code +COPY --chown=www-data:www-data . /var/www/html/ + +EXPOSE 80 \ No newline at end of file diff --git a/captcha.php b/captcha.php index be75678..e00ab5b 100644 --- a/captcha.php +++ b/captcha.php @@ -30,5 +30,4 @@ header("Pragma: no-cache"); header("Accept-Ranges: bytes"); header("Content-type: image/png"); ImageTtfText($img, $ttfsize, $angle, $t_x, $t_y, $color, $ttf, $captchaText); -ImagePNG($img); -ImageDestroy($img); \ No newline at end of file +ImagePNG($img); \ No newline at end of file