Add Docker deployment configuration

- Add Dockerfile with multi-stage build for Next.js standalone
- Add docker-compose.yml with Traefik labels for decolonizeti.me
- Add .dockerignore for optimized builds
- Enable standalone output in next.config.mjs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-11-26 19:14:28 -08:00
parent f50d24732a
commit 8e05f65833
4 changed files with 69 additions and 2 deletions

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
node_modules
.git
.gitignore
.next
*.md
.env*
Dockerfile
docker-compose*.yml
.dockerignore

43
Dockerfile Normal file
View File

@ -0,0 +1,43 @@
FROM node:20-alpine AS base
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Dependencies stage
FROM base AS deps
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
# Build stage
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm build
# Production stage
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
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"]

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
services:
decolonize-time:
build: .
container_name: decolonize-time
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.decolonize-time.rule=Host(`decolonizeti.me`) || Host(`www.decolonizeti.me`)"
- "traefik.http.services.decolonize-time.loadbalancer.server.port=3000"
networks:
- traefik-public
networks:
traefik-public:
external: true

View File

@ -6,7 +6,7 @@ const nextConfig = {
images: { images: {
unoptimized: true, unoptimized: true,
}, },
output: 'standalone',
} }
export default nextConfig export default nextConfig