Run development on the production stack with a Vite dev server

docker-compose.dev.yml extends docker-compose.yml, so development runs the
scheduler too, and takes its settings from .env, which selects the file
through COMPOSE_FILE. The dev image is a stage of the Dockerfile and shares
the production image's PHP extensions; the app listens on port 80 as in
production.

A vite service runs the dev server with hot reload. No ports are published:
OrbStack serves https://app.sealshare.orb.local and
https://vite.sealshare.orb.local, with the ports pinned by label. Without
OrbStack, docker-compose.ports.yml publishes APP_PORT and VITE_PORT on
127.0.0.1. vite.config.js takes the dev server's address from
VITE_DEV_SERVER_URL and listens on IPv4 and IPv6, as OrbStack's proxy
connects over either.

Each start installs Composer packages, clears caches, migrates and links
storage.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
surtic86
2026-09-18 22:17:36 +02:00
co-authored by Claude Opus 5
parent 9bb144577b
commit 026912f98a
9 changed files with 203 additions and 91 deletions
+8 -10
View File
@@ -13,16 +13,13 @@ max_input_time = ${PHP_MAX_INPUT_TIME:-300}
memory_limit = ${PHP_MEMORY_LIMIT:-512M}
EOF
if [ ! -f vendor/autoload.php ]; then
echo "[dev] Installing PHP dependencies..."
composer install --no-interaction 2>&1
fi
# Every start, so a pull with new packages needs no extra step; with nothing new it takes a second
echo "[dev] Installing PHP dependencies..."
composer install --no-interaction 2>&1
echo "[dev] Installing Node dependencies..."
npm install 2>&1
echo "[dev] Building frontend assets..."
npm run build 2>&1
# A config or route cache left by `php artisan optimize` would hide changes to the checkout
echo "[dev] Clearing caches..."
php artisan optimize:clear
echo "[dev] Running database migrations..."
php artisan migrate --force
@@ -30,5 +27,6 @@ php artisan migrate --force
echo "[dev] Creating storage link..."
php artisan storage:link --force
# Port 80 as in production, so the same healthcheck applies. The vite service serves the assets.
echo "[dev] Starting Octane (FrankenPHP) with --watch..."
exec php artisan octane:frankenphp --host=0.0.0.0 --port=8000 --watch --workers=1 --max-requests=1
exec php artisan octane:frankenphp --host=0.0.0.0 --port=80 --watch --workers=1 --max-requests=1
-19
View File
@@ -1,19 +0,0 @@
FROM dunglas/frankenphp:php8.5-alpine
# Install required PHP extensions
RUN install-php-extensions \
intl \
pcntl
# Install Node.js for Vite / frontend asset building
RUN apk add --no-cache nodejs npm
# Composer, for a checkout without vendor/: the assets import Livewire Material from it
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
WORKDIR /app
COPY docker/dev-entrypoint.sh /usr/local/bin/dev-entrypoint.sh
RUN chmod +x /usr/local/bin/dev-entrypoint.sh
ENTRYPOINT ["dev-entrypoint.sh"]