fix(deploy): optimize Dockerfile for disk efficiency and add runner diagnostics
Some checks failed
Some checks failed
This commit is contained in:
@@ -154,9 +154,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||||
|
|
||||||
- name: 🧹 Clean runner
|
- name: Clean runner
|
||||||
run: |
|
run: |
|
||||||
|
echo "Disk space before prune:"
|
||||||
|
df -h
|
||||||
docker system prune -af --volumes
|
docker system prune -af --volumes
|
||||||
|
docker builder prune -af
|
||||||
|
echo "Disk space after prune:"
|
||||||
|
df -h
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: 🏗️ Build and Push
|
- name: 🏗️ Build and Push
|
||||||
|
|||||||
11
Dockerfile
11
Dockerfile
@@ -72,17 +72,14 @@ WORKDIR /app
|
|||||||
|
|
||||||
# Copy standalone output and static files (Monorepo paths)
|
# Copy standalone output and static files (Monorepo paths)
|
||||||
# Note: Base image already handles the non-root user and basic env
|
# 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 --chown=1001:65533 /app/apps/web/public ./apps/web/public
|
||||||
COPY --from=builder /app/apps/web/.next/standalone ./
|
COPY --from=builder --chown=1001:65533 /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/.next/static ./apps/web/.next/static
|
||||||
|
|
||||||
# Explicitly copy Payload dynamically generated importMap.js excluded by Standalone tracing
|
# 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)
|
# 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
|
USER nextjs
|
||||||
|
|
||||||
# Start from the app directory to ensure references solve correctly
|
# Start from the app directory to ensure references solve correctly
|
||||||
|
|||||||
Reference in New Issue
Block a user