From 634257442cef8d1abf6960bf659dd3009fa3da2c Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 26 Sep 2025 16:23:28 +0200 Subject: [PATCH] fix: Update CI/CD pipeline for Next.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Updated Gitea workflow to build Next.js instead of Nuxt - Removed working-directory references to apps/website - Created Dockerfile for Next.js production builds - Added standalone output mode to next.config.js for Docker - Updated build and artifact paths in workflow 🤖 Generated with Claude Code Co-Authored-By: Claude --- .gitea/workflows/build.yml | 12 +++-------- Dockerfile | 41 ++++++++++++++++++++++++++++++++++++++ next.config.js | 1 + 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 Dockerfile diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 70e31d1..18d1ff2 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -18,15 +18,9 @@ jobs: - name: Install dependencies run: npm ci - working-directory: apps/website - - name: Nuxt prepare - run: npm run postinstall - working-directory: apps/website - - - name: Build Nuxt + - name: Build Next.js run: npm run build - working-directory: apps/website - name: Install Docker CLI run: | @@ -40,7 +34,7 @@ jobs: env: IMAGE: code.harborsmith.co/matt/website run: | - docker build -f apps/website/Dockerfile.prod -t $IMAGE:${{ github.sha }} apps/website + docker build -f Dockerfile -t $IMAGE:${{ github.sha }} . docker push $IMAGE:${{ github.sha }} docker tag $IMAGE:${{ github.sha }} $IMAGE:latest docker push $IMAGE:latest @@ -49,4 +43,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: website-dist - path: apps/website/.output/public + path: .next diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..7926ee4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,41 @@ +# Build stage +FROM node:20-alpine AS builder +WORKDIR /app + +# Copy package files +COPY package*.json ./ + +# Install dependencies +RUN npm ci + +# Copy all files +COPY . . + +# Build Next.js app +RUN npm run build + +# Production stage +FROM node:20-alpine AS runner +WORKDIR /app + +ENV NODE_ENV production + +# Create a non-root user +RUN addgroup -g 1001 -S nodejs +RUN adduser -S nextjs -u 1001 + +# Copy built application +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static + +# Change ownership +RUN chown -R nextjs:nodejs /app + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/next.config.js b/next.config.js index c31ddc3..26056a9 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + output: 'standalone', images: { domains: ['videos.pexels.com'], },