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'], },