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
+32 -10
View File
@@ -39,20 +39,44 @@ COPY --from=vendor /app/vendor/nonameweb ./vendor/nonameweb
RUN npm run build
# ============================================
# Stage 3: Production image (FrankenPHP/Octane)
# Stage 3: PHP runtime, shared by development and production
# ============================================
FROM dunglas/frankenphp:php8.5-alpine AS production
FROM dunglas/frankenphp:php8.5-alpine AS base
LABEL maintainer="surtic86"
LABEL org.opencontainers.image.source="https://gitea.nonameweb.ch/noNameWEB/SealShare"
LABEL org.opencontainers.image.description="Self-hosted encrypted file sharing"
# Install required PHP extensions
RUN install-php-extensions \
intl \
pcntl \
zip
WORKDIR /app
# ============================================
# Stage 4: Development image (docker-compose.dev.yml)
# ============================================
# Holds only the tools: the checkout is mounted at /app, and its entrypoint runs from there.
FROM base AS dev
# For the dev packages: Pest's browser plugin needs sockets
RUN install-php-extensions sockets
# Node.js for the Vite dev server
RUN apk add --no-cache nodejs npm
# Composer: the entrypoint installs the packages on every start
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
ENTRYPOINT ["docker/dev-entrypoint.sh"]
# ============================================
# Stage 5: Production image (FrankenPHP/Octane)
# ============================================
# The last stage, so a build without --target builds this one.
FROM base AS production
LABEL maintainer="surtic86"
LABEL org.opencontainers.image.source="https://gitea.nonameweb.ch/noNameWEB/SealShare"
LABEL org.opencontainers.image.description="Self-hosted encrypted file sharing"
# Laravel environment defaults
ENV APP_NAME="SealShare" \
APP_ENV="production" \
@@ -69,8 +93,6 @@ ENV APP_NAME="SealShare" \
BCRYPT_ROUNDS="12" \
OCTANE_SERVER="frankenphp"
WORKDIR /app
# Copy PHP ini for upload limits
COPY docker/php/uploads.ini /usr/local/etc/php/conf.d/99-uploads.ini
@@ -84,7 +106,7 @@ COPY --from=vendor /app/vendor ./vendor
COPY --from=assets /app/public/build ./public/build
# Remove dev/build files and stale cache not needed in production
RUN rm -rf node_modules tests .gitea docker/dev.Dockerfile docker/dev-entrypoint.sh .env .env.example \
RUN rm -rf node_modules tests .gitea docker/dev-entrypoint.sh .env .env.example \
bootstrap/cache/*.php \
&& mkdir -p storage/app/shares storage/app/public storage/framework/cache \
storage/framework/sessions storage/framework/testing storage/framework/views \