fix: Update CI/CD pipeline for Next.js
Some checks failed
build-website / build (push) Failing after 35s
Some checks failed
build-website / build (push) Failing after 35s
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -18,15 +18,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
working-directory: apps/website
|
|
||||||
|
|
||||||
- name: Nuxt prepare
|
- name: Build Next.js
|
||||||
run: npm run postinstall
|
|
||||||
working-directory: apps/website
|
|
||||||
|
|
||||||
- name: Build Nuxt
|
|
||||||
run: npm run build
|
run: npm run build
|
||||||
working-directory: apps/website
|
|
||||||
|
|
||||||
- name: Install Docker CLI
|
- name: Install Docker CLI
|
||||||
run: |
|
run: |
|
||||||
@@ -40,7 +34,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
IMAGE: code.harborsmith.co/matt/website
|
IMAGE: code.harborsmith.co/matt/website
|
||||||
run: |
|
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 push $IMAGE:${{ github.sha }}
|
||||||
docker tag $IMAGE:${{ github.sha }} $IMAGE:latest
|
docker tag $IMAGE:${{ github.sha }} $IMAGE:latest
|
||||||
docker push $IMAGE:latest
|
docker push $IMAGE:latest
|
||||||
@@ -49,4 +43,4 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: website-dist
|
name: website-dist
|
||||||
path: apps/website/.output/public
|
path: .next
|
||||||
|
|||||||
41
Dockerfile
Normal file
41
Dockerfile
Normal file
@@ -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"]
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
output: 'standalone',
|
||||||
images: {
|
images: {
|
||||||
domains: ['videos.pexels.com'],
|
domains: ['videos.pexels.com'],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user