- Config: auth, services, logging, queue and database only repeated the
framework's own files and are gone; the others keep only the keys that
differ (app version, cache serializable_classes, session cookie name,
Markdown mail theme, the shares disk, three Octane values, Livewire's
pagination theme and payload guards).
- Email verification is removed: User never implemented MustVerifyEmail,
so it was never enforced, and SealShare has a single admin and no
registration. CreateNewUser goes with it.
- FileEncryptionService::encryptFile() and generateSalt() were only used
by tests; tests build files with encryptTestFile() in tests/Pest.php.
- The expiration options are defined once, as Share::EXPIRATIONS. "30 Days"
now lasts 30 days instead of a calendar month, and Admin settings only
save a default expiration that is one of the options.
- One-caller helpers are inlined, the uploader reads chunk responses with
XHR's responseType, and starter-kit leftovers are removed.
- Docker: PHP reads the PHP_* limits from the environment itself
(${VAR:-default} in uploads.ini); both entrypoints stop writing the ini.
docker-compose.yml shares the app and scheduler variables through one
anchor. The dev image installs gd for the screenshot publisher and fake
test images.
- Development runs in Docker only: the composer dev script, concurrently,
laravel/pail, laravel/sail, autoprefixer and the shell-quote override
are gone.
- phpunit.xml forces the test environment with <server> entries, so tests
run in the dev container no longer use its real database.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
134 lines
4.3 KiB
Docker
134 lines
4.3 KiB
Docker
# ============================================
|
|
# Stage 1: Install PHP dependencies
|
|
# ============================================
|
|
# Built on the build machine's own platform: vendor/ is plain PHP, the same for every target, so a
|
|
# multi-arch build runs it once and never under emulation.
|
|
FROM --platform=$BUILDPLATFORM composer:2 AS vendor
|
|
|
|
WORKDIR /app
|
|
|
|
COPY composer.json composer.lock* ./
|
|
|
|
RUN composer install \
|
|
--no-dev \
|
|
--no-interaction \
|
|
--no-autoloader \
|
|
--no-scripts \
|
|
--prefer-dist
|
|
|
|
COPY . .
|
|
|
|
RUN composer dump-autoload --optimize --no-dev
|
|
|
|
# ============================================
|
|
# Stage 2: Build frontend assets
|
|
# ============================================
|
|
# After Composer: the stylesheet and script import Livewire Material from vendor/. On the build
|
|
# machine's platform too: the output is CSS and JavaScript, whatever the target.
|
|
FROM --platform=$BUILDPLATFORM node:24-alpine AS assets
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci --prefer-offline
|
|
|
|
COPY vite.config.js ./
|
|
COPY resources/ ./resources/
|
|
COPY --from=vendor /app/vendor/nonameweb ./vendor/nonameweb
|
|
|
|
RUN npm run build
|
|
|
|
# ============================================
|
|
# Stage 3: PHP runtime, shared by development and production
|
|
# ============================================
|
|
FROM dunglas/frankenphp:php8.5-alpine AS base
|
|
|
|
RUN install-php-extensions \
|
|
intl \
|
|
pcntl \
|
|
zip
|
|
|
|
# PHP limits, read from PHP_* environment variables by PHP itself
|
|
COPY docker/php/uploads.ini /usr/local/etc/php/conf.d/99-uploads.ini
|
|
|
|
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; the screenshot publisher and fake test
|
|
# images need gd (the app itself never processes images, so production goes without)
|
|
RUN install-php-extensions sockets gd
|
|
|
|
# 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" \
|
|
APP_DEBUG="false" \
|
|
APP_URL="http://localhost" \
|
|
LOG_CHANNEL="stderr" \
|
|
LOG_LEVEL="warning" \
|
|
DB_CONNECTION="sqlite" \
|
|
SESSION_DRIVER="database" \
|
|
QUEUE_CONNECTION="database" \
|
|
CACHE_STORE="database" \
|
|
FILESYSTEM_DISK="local" \
|
|
BROADCAST_CONNECTION="log" \
|
|
BCRYPT_ROUNDS="12" \
|
|
OCTANE_SERVER="frankenphp"
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Copy vendor dependencies from composer stage
|
|
COPY --from=vendor /app/vendor ./vendor
|
|
|
|
# Copy built frontend assets from node stage
|
|
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-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 \
|
|
storage/logs database/sqlite \
|
|
&& chmod -R 777 storage database bootstrap/cache
|
|
|
|
# A docker-compose.yml from before 2.1.1 mounts the SQLite volume over all of database/, which hides
|
|
# the migrations of every later image; the entrypoint adds the ones the volume is missing from here.
|
|
RUN cp -R database/migrations docker/migrations
|
|
|
|
# Create SQLite database file if it doesn't exist
|
|
RUN touch database/database.sqlite \
|
|
&& chmod 666 database/database.sqlite
|
|
|
|
# Make entrypoint and healthcheck executable
|
|
RUN chmod +x docker/entrypoint.sh docker/healthcheck.sh
|
|
|
|
EXPOSE 80 443 443/udp
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD /app/docker/healthcheck.sh
|
|
|
|
ENTRYPOINT ["docker/entrypoint.sh"]
|