QEMU 8.x crashes running x86_64 programs on an arm64 host (QEMU issue 2168), which the 8.1.5 pin walked into, and 10.2 segfaults on the runner as well; 9.2.2 runs node, composer and install-php-extensions on the runner's host. The Composer and npm stages now build on the build machine's platform: their output is the same for every target, so a multi-arch build runs them once and natively. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V9NnLxnPp8vaaurb3Z1MFy
110 lines
3.2 KiB
Docker
110 lines
3.2 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: Production image (FrankenPHP/Octane)
|
|
# ============================================
|
|
FROM dunglas/frankenphp:php8.5-alpine 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"
|
|
|
|
# Install required PHP extensions
|
|
RUN install-php-extensions \
|
|
intl \
|
|
pcntl \
|
|
zip
|
|
|
|
# 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"
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy Caddyfile
|
|
COPY docker/Caddyfile /etc/caddy/Caddyfile
|
|
|
|
# Copy PHP ini for upload limits
|
|
COPY docker/php/uploads.ini /usr/local/etc/php/conf.d/99-uploads.ini
|
|
|
|
# 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.Dockerfile 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 \
|
|
&& chmod -R 777 storage database bootstrap/cache
|
|
|
|
# Create SQLite database file if it doesn't exist
|
|
RUN touch database/database.sqlite \
|
|
&& chmod 666 database/database.sqlite
|
|
|
|
# Make entrypoint executable
|
|
RUN chmod +x docker/entrypoint.sh
|
|
|
|
EXPOSE 80 443 443/udp
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
|
CMD curl --silent --fail http://localhost/up || exit 1
|
|
|
|
ENTRYPOINT ["docker/entrypoint.sh"]
|