From 189dc975bd35cf9adc8febcea6f56e24274c1f5b Mon Sep 17 00:00:00 2001 From: Jonatan Rek Date: Wed, 28 Jan 2026 10:40:10 +0100 Subject: [PATCH] Refactor Docker setup: move Dockerfiles to respective directories and add supervisor configurations --- .gitea/workflows/docker-build.yaml | 36 +++++++- Dockerfile => apache/Dockerfile | 0 .../supervisor}/conf.d/laravel-queues.conf | 0 .../supervisor}/supervisord.conf | 0 fmp-alpine/Dockerfile | 83 +++++++++++++++++++ 5 files changed, 116 insertions(+), 3 deletions(-) rename Dockerfile => apache/Dockerfile (100%) rename {supervisor => apache/supervisor}/conf.d/laravel-queues.conf (100%) rename {supervisor => apache/supervisor}/supervisord.conf (100%) create mode 100644 fmp-alpine/Dockerfile diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index f90c93b..8dddafa 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -33,10 +33,8 @@ jobs: - uses: docker/build-push-action@v6 with: - context: . + context: ./apache/ push: true - labels: | - org.steelants.image.traffic.version=${{ env.release_version }} tags: git.steelants.cz/steelants/docker_php_base:latest # ✅ Notifikace při úspěšném deploymentu @@ -52,6 +50,38 @@ jobs: Commit: ${{ github.sha }} Version: ${{ env.release_version }} + # ❌ Notifikace při neúspěšném deploymentu + - name: Discord Webhook Failure + if: failure() + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ secrets.WEBHOOK_URL }} + content: | + ❌ Build failed! + Repo: ${{ github.repository }} + Branch: ${{ github.ref_name }} + Commit: ${{ github.sha }} + Version: ${{ env.release_version }} + + - uses: docker/build-push-action@v6 + with: + context: ./fmp-alpine/ + push: true + tags: git.steelants.cz/steelants/docker_php_base:fpm-alpine-latest + + # ✅ Notifikace při úspěšném deploymentu + - name: Discord Webhook Success + if: success() + uses: tsickert/discord-webhook@v6.0.0 + with: + webhook-url: ${{ secrets.WEBHOOK_URL }} + content: | + ✅ Build successful! + Repo: ${{ github.repository }} + Branch: ${{ github.ref_name }} + Commit: ${{ github.sha }} + Version: ${{ env.release_version }} + # ❌ Notifikace při neúspěšném deploymentu - name: Discord Webhook Failure if: failure() diff --git a/Dockerfile b/apache/Dockerfile similarity index 100% rename from Dockerfile rename to apache/Dockerfile diff --git a/supervisor/conf.d/laravel-queues.conf b/apache/supervisor/conf.d/laravel-queues.conf similarity index 100% rename from supervisor/conf.d/laravel-queues.conf rename to apache/supervisor/conf.d/laravel-queues.conf diff --git a/supervisor/supervisord.conf b/apache/supervisor/supervisord.conf similarity index 100% rename from supervisor/supervisord.conf rename to apache/supervisor/supervisord.conf diff --git a/fmp-alpine/Dockerfile b/fmp-alpine/Dockerfile new file mode 100644 index 0000000..a573415 --- /dev/null +++ b/fmp-alpine/Dockerfile @@ -0,0 +1,83 @@ +FROM php:8.4-fpm-alpine + +ENV TZ="Europe/Prague" \ + PHP_OPCACHE_ENABLE=1 \ + PHP_OPCACHE_VALIDATE_TIMESTAMPS=0 \ + PHP_OPCACHE_REVALIDATE_FREQ=0 \ + PHP_OPCACHE_MEMORY_CONSUMPTION=192 \ + PHP_OPCACHE_MAX_ACCELERATED_FILES=20000 \ + PHP_OPCACHE_MAX_WASTED_PERCENTAGE=10 \ + PHP_OPCACHE_INTERNED_STRINGS_BUFFER=16 \ + APP_ENV=production \ + APP_DEBUG=false + +RUN apk add --no-cache \ + tzdata \ + bash \ + ca-certificates \ + libpq \ + libzip \ + imagemagick \ + imagemagick-dev \ + librsvg \ + freetype \ + libjpeg-turbo \ + libpng \ + icu \ + oniguruma \ + libxml2 + +RUN apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + postgresql-dev \ + libzip-dev \ + freetype-dev \ + libjpeg-turbo-dev \ + libpng-dev \ + icu-dev \ + libxml2-dev + +RUN docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + && docker-php-ext-install -j$(nproc) \ + pdo_mysql \ + pdo_pgsql \ + pgsql \ + zip \ + bcmath \ + soap \ + sockets \ + pcntl \ + gd \ + intl \ + opcache + +RUN pecl install imagick \ + && docker-php-ext-enable imagick + +RUN apk del .build-deps + +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \ + && echo "date.timezone=${TZ}" > "$PHP_INI_DIR/conf.d/99-timezone.ini" + +RUN { \ + echo "memory_limit=256M"; \ + echo "upload_max_filesize=100M"; \ + echo "post_max_size=100M"; \ + echo "realpath_cache_size=4096K"; \ + echo "realpath_cache_ttl=600"; \ +} > "$PHP_INI_DIR/conf.d/99-laravel.ini" + +RUN { \ + echo "[opcache]"; \ + echo "opcache.enable=${PHP_OPCACHE_ENABLE}"; \ + echo "opcache.enable_cli=0"; \ + echo "opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}"; \ + echo "opcache.revalidate_freq=${PHP_OPCACHE_REVALIDATE_FREQ}"; \ + echo "opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}"; \ + echo "opcache.interned_strings_buffer=${PHP_OPCACHE_INTERNED_STRINGS_BUFFER}"; \ + echo "opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}"; \ + echo "opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}"; \ + echo "opcache.save_comments=1"; \ +} > "$PHP_INI_DIR/conf.d/10-opcache.ini" \ No newline at end of file