Deployment
Docker Production Build
DutyDuke includes a Dockerfile for production deployments.
Build the image
docker build -t dutyduke .
The Dockerfile:
- Installs dependencies with
yarn install --ignore-scripts - Generates the Prisma client
- Builds the Next.js application
- On start: runs migrations, then starts the server
Run with Docker Compose
For a full production-like setup, use Docker Compose with your own .env:
# Start PostgreSQL + Mailcatcher
docker compose up -d
# Or run the app container alongside
docker build -t dutyduke .
docker run --env-file .env -p 3000:3000 --network host dutyduke
Production Environment
For production, ensure:
-
Generate unique secrets:
# JWT Secret
node -e "console.log(require('crypto').randomBytes(128).toString('hex'))"
# Prisma encryption key
# Generate at https://cloak.47ng.com/ -
Configure SMTP — point
mailer_smtp_*variables to your email provider -
Set the app URL —
NEXT_PUBLIC_APP_URLmust match your domain -
Use a managed database — or ensure PostgreSQL has PostGIS installed:
CREATE EXTENSION IF NOT EXISTS postgis; -
Run migrations on deploy:
yarn prisma:migrate:deployThe Dockerfile CMD does this automatically on container start.
Database Migrations
Development
yarn prisma:migrate # Creates and applies a new migration
Production
yarn prisma:migrate:deploy # Applies pending migrations (no prompts)
Reset (development only)
yarn prisma:reset # Drops and recreates the database
Environment Checklist
Before deploying to production:
- Unique
JWT_SECRETgenerated - Unique
PRISMA_FIELD_ENCRYPTION_KEYgenerated -
NEXT_PUBLIC_APP_URLset to production domain - SMTP configured for real email delivery
-
SUPPORT_PASSWORDset to a strong value - PostgreSQL has PostGIS extension enabled
- Database backups configured