From 34a683b61403e23e47f5f90b3c77739d34fb4379 Mon Sep 17 00:00:00 2001 From: Meghdad Date: Tue, 19 May 2026 18:58:14 +0330 Subject: [PATCH] Fixed the Docker build stage that runs npm run build --- dockerized/SKILL.md | 2 +- dockerized/docker/app/Dockerfile | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/dockerized/SKILL.md b/dockerized/SKILL.md index 95c1b21..81e871a 100644 --- a/dockerized/SKILL.md +++ b/dockerized/SKILL.md @@ -40,7 +40,7 @@ Only publish HTTP and RTMP by default. Keep MediaMTX HLS behind Apache and keep - When changing MediaMTX ports, update Compose environment, published ports, entrypoint defaults, and the template together. - When changing Laravel runtime behavior, update the shared `x-app-environment` block unless the value belongs to one role only. - When changing queue behavior, prefer env-driven options on the `queue` service and `docker/app/entrypoint.sh`. -- Keep `npm run build` after PHP setup and Composer install in `docker/app/Dockerfile`; the Wayfinder Vite plugin invokes `php artisan wayfinder:generate` during the build. +- Keep `npm run build` after PHP setup and Composer install in `docker/app/Dockerfile`; the Wayfinder Vite plugin invokes `php artisan wayfinder:generate` during the build. The asset stage must also provide safe build-time Laravel env values and should run `php artisan wayfinder:generate --with-form --no-interaction` before `npm run build` so failures are visible in Docker logs. - Keep deploy script behavior idempotent: repeat runs should update the Git checkout, rebuild, migrate, and restart services without deleting volumes. - Keep generated secrets in `.env`; do not bake secrets into images or templates. diff --git a/dockerized/docker/app/Dockerfile b/dockerized/docker/app/Dockerfile index 369215d..bcca9f6 100644 --- a/dockerized/docker/app/Dockerfile +++ b/dockerized/docker/app/Dockerfile @@ -16,6 +16,7 @@ RUN apt-get update \ libcurl4-openssl-dev \ libonig-dev \ libpq-dev \ + libsqlite3-dev \ libzip-dev \ netcat-openbsd \ unzip \ @@ -27,7 +28,9 @@ RUN apt-get update \ opcache \ pcntl \ pdo_pgsql \ + pdo_sqlite \ pgsql \ + sqlite3 \ zip \ && pecl install redis \ && docker-php-ext-enable redis \ @@ -45,6 +48,24 @@ RUN composer install --no-dev --no-interaction --prefer-dist --optimize-autoload FROM php-base AS assets +ENV APP_NAME=Nyone \ + APP_ENV=production \ + APP_DEBUG=false \ + APP_KEY=base64:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \ + APP_URL=http://localhost \ + LOG_CHANNEL=stderr \ + DB_CONNECTION=sqlite \ + DB_DATABASE=:memory: \ + CACHE_STORE=array \ + SESSION_DRIVER=array \ + QUEUE_CONNECTION=sync \ + MAIL_MAILER=log \ + BROADCAST_CONNECTION=log \ + FILESYSTEM_DISK=local \ + VITE_APP_NAME=Nyone \ + STREAMING_VIEWER_COUNT_CACHE_STORE=array \ + MEDIAMTX_SHARED_SECRET=build-time-secret + COPY --from=node:22-bookworm-slim /usr/local/bin/node /usr/local/bin/node COPY --from=node:22-bookworm-slim /usr/local/lib/node_modules /usr/local/lib/node_modules RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \ @@ -60,6 +81,7 @@ COPY runtime/source/ ./ RUN composer dump-autoload --optimize --no-dev \ && php artisan package:discover --ansi \ && php artisan route:clear \ + && php artisan wayfinder:generate --with-form --no-interaction \ && npm run build FROM php-base AS app