Archived
Add Docker build + Gitea Actions CI for self-hosting
build-and-publish / build (push) Failing after 11s
build-and-publish / build (push) Failing after 11s
- next.config: output 'standalone' for a self-contained server bundle - Dockerfile: multi-stage Next.js build (node:22-alpine) - .gitea/workflows/deploy.yml: build + push to the Gitea registry Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
.next
|
||||
.git
|
||||
npm-debug.log
|
||||
.env
|
||||
.env.local
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
README.md
|
||||
default.nix
|
||||
@@ -0,0 +1,25 @@
|
||||
name: build-and-publish
|
||||
on:
|
||||
push:
|
||||
branches: [master, main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to the Gitea container registry
|
||||
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.thebennett.net -u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||
|
||||
- name: Build image
|
||||
run: |
|
||||
docker build \
|
||||
-t git.thebennett.net/austin/itsthevine:latest \
|
||||
-t git.thebennett.net/austin/itsthevine:${{ github.sha }} .
|
||||
|
||||
- name: Push image
|
||||
run: |
|
||||
docker push git.thebennett.net/austin/itsthevine:latest
|
||||
docker push git.thebennett.net/austin/itsthevine:${{ github.sha }}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# Multi-stage build for the Next.js (standalone) itsthevine.com site.
|
||||
|
||||
FROM node:22-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
# framer-motion@11 declares a React 18 peer; project is on React 19 (as built on Vercel)
|
||||
RUN npm ci --legacy-peer-deps
|
||||
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production \
|
||||
NEXT_TELEMETRY_DISABLED=1 \
|
||||
PORT=3000 \
|
||||
HOSTNAME=0.0.0.0
|
||||
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
||||
# standalone output already contains a minimal node_modules + server.js
|
||||
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
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
CMD ["node", "server.js"]
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: 'standalone', // self-contained server bundle for the Docker image
|
||||
images: {
|
||||
remotePatterns: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user