From 7d6d34dd7b3525321c150c53572076869a6d3a92 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 11 Apr 2026 23:54:23 +0200 Subject: [PATCH] fix(deploy): optimize Dockerfile for disk efficiency and add runner diagnostics --- .gitea/workflows/deploy.yml | 7 ++++++- Dockerfile | 11 ++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index c23b413..f6c49f7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -154,9 +154,14 @@ jobs: run: | echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin - - name: ๐Ÿงน Clean runner + - name: Clean runner run: | + echo "Disk space before prune:" + df -h docker system prune -af --volumes + docker builder prune -af + echo "Disk space after prune:" + df -h continue-on-error: true - name: ๐Ÿ—๏ธ Build and Push diff --git a/Dockerfile b/Dockerfile index be29926..a8a38ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,17 +72,14 @@ WORKDIR /app # Copy standalone output and static files (Monorepo paths) # Note: Base image already handles the non-root user and basic env -COPY --from=builder /app/apps/web/public ./apps/web/public -COPY --from=builder /app/apps/web/.next/standalone ./ -COPY --from=builder /app/apps/web/.next/static ./apps/web/.next/static +COPY --from=builder --chown=1001:65533 /app/apps/web/public ./apps/web/public +COPY --from=builder --chown=1001:65533 /app/apps/web/.next/standalone ./ +COPY --from=builder --chown=1001:65533 /app/apps/web/.next/static ./apps/web/.next/static # Explicitly copy Payload dynamically generated importMap.js excluded by Standalone tracing -COPY --from=builder /app/apps/web/app/(payload)/admin/importMap.js ./apps/web/app/(payload)/admin/importMap.js +COPY --from=builder --chown=1001:65533 /app/apps/web/app/(payload)/admin/importMap.js ./apps/web/app/(payload)/admin/importMap.js # Fix permissions for the non-root user (Standard uid/gid from base image) -# We do this as root before switching users -USER root -RUN chown -R 1001:65533 /app USER nextjs # Start from the app directory to ensure references solve correctly