diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index eb1b255..8d525e6 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -200,7 +200,6 @@ jobs: - name: Build frontend container image run: | podman --remote build --no-cache \ - --storage-opt overlay.mountopt=size=20G \ --build-arg NEXT_PUBLIC_API_HOST=${{ secrets.PROD_BACKEND_HOST }} \ --build-arg NEXT_PUBLIC_API_PORT=${{ secrets.PROD_BACKEND_PORT }} \ -f frontend/Dockerfile \ diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 998b84f..6c5cd50 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,23 +1,10 @@ -# ---------- deps ---------- -FROM docker.io/node:20-alpine AS deps -WORKDIR /app - -# Install only dependencies first -COPY package*.json ./ -RUN npm install --production --no-audit --no-fund - # ---------- build ---------- -FROM docker.io/node:20-alpine AS builder +FROM docker.io/node:20-slim AS builder WORKDIR /app -# Copy production dependencies from deps stage -COPY --from=deps /app/node_modules ./node_modules - -# Copy package files +# Install dependencies with minimal footprint COPY package*.json ./ - -# Install dev dependencies -RUN npm install --only=dev --no-audit --no-fund +RUN npm cache clean --force && npm install --no-audit --no-fund --prefer-offline # Copy app source COPY . . @@ -32,11 +19,11 @@ ENV NEXT_PUBLIC_API_HOST=${NEXT_PUBLIC_API_HOST} ENV NEXT_PUBLIC_API_PORT=${NEXT_PUBLIC_API_PORT} RUN npm run build -# Clean up unnecessary files to save space after build -RUN rm -rf node_modules .next/cache +# Clean up to save space +RUN rm -rf node_modules .next/cache ~/.npm # ---------- runner (standalone) ---------- -FROM docker.io/node:20-alpine AS runner +FROM docker.io/node:20-slim AS runner WORKDIR /app # runtime env