Add Docker configuration for self-hosted deployment

- Add Dockerfile with Next.js standalone output
- Add docker-compose.yml with Traefik labels
- Enable standalone output in next.config.js for optimized Docker builds

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2025-12-06 18:20:42 +01:00
parent 978746347f
commit f3b259ab90
3 changed files with 44 additions and 0 deletions

27
Dockerfile Normal file
View File

@ -0,0 +1,27 @@
# Build stage
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# Copy built assets
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]

16
docker-compose.yml Normal file
View File

@ -0,0 +1,16 @@
services:
betting-app:
build: .
container_name: betting-app-prod
restart: unless-stopped
labels:
- "traefik.enable=true"
- "traefik.http.routers.betting-app.rule=Host(`betting.jeffemmett.com`)"
- "traefik.http.routers.betting-app.entrypoints=web"
- "traefik.http.services.betting-app.loadbalancer.server.port=3000"
networks:
- traefik-public
networks:
traefik-public:
external: true

View File

@ -2,6 +2,7 @@
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: 'standalone',
// Environment variables that should be available on the client side
env: {
NEXT_PUBLIC_PUSHER_APP_KEY: process.env.NEXT_PUBLIC_PUSHER_APP_KEY,