revert main workflow adjust Dockerfiel and integrate build proccess
Some checks failed
Next.js App CI / docker (push) Failing after 50s

This commit is contained in:
2025-09-15 00:02:39 +02:00
parent 3c3968a5eb
commit fbb1c570c4
2 changed files with 13 additions and 40 deletions

View File

@@ -17,46 +17,7 @@ jobs:
registry: ${{vars.LOCAL_REGISTRY}}
username: ${{ VARS.USER }}
password: ${{ secrets.TOKEN }}
- name: Generate Static Image Assets
run: |
echo "--- Runner workspace is at: ${{ gitea.workspace }} ---"
echo "--- Listing files on runner before mounting: ---"
ls -laR ${{ gitea.workspace }}
docker run --rm \
-v "${{ gitea.workspace }}:/work" \
-w "/work" \
archlinux:latest \
bash -c '
set -e
echo "--- Verifying files mounted inside container: ---"
ls -laR
echo "--- Installing dependencies ---"
pacman -Syu --noconfirm imagemagick libwebp ghostscript
echo "--- Generating assets ---"
chmod +x ./scripts/*.sh
bash ./scripts/first_page_image.sh
bash ./scripts/generate_webp.sh
echo "--- Asset generation complete. Verifying output files: ---"
ls -laR ./public/assets
'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install Node.js Dependencies
run: npm ci
- name: Build Next.js App
run: npm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

View File

@@ -1,18 +1,29 @@
# Stage 1: Builder
FROM node:20-alpine AS builder
# Install system dependencies for image manipulation (ImageMagick v7+)
RUN apk add --no-cache imagemagick webp ghostscript
# Enable pnpm
RUN corepack enable
WORKDIR /app
# Copy dependency files and install dependencies
# This is cached separately from the source code
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Copy the rest of the application source code
COPY . .
# --- Asset Generation Step ---
# Run scripts to generate static images BEFORE the Next.js build
# The build needs these assets to be present.
RUN chmod +x ./scripts/*.sh && \
./scripts/first_page_image.sh && \
./scripts/generate_webp.sh
# Run the build command
RUN pnpm run build
@@ -28,6 +39,7 @@ RUN adduser --system --uid 1001 nextjs
USER nextjs
# Copy the standalone output from the builder stage
# The './public' directory now contains the newly generated assets
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static