Skip to main content

Docker Deployment

Deploy your Ever Works directory website using Docker containers.

Prerequisites

  • Docker installed on your system
  • Docker Compose (optional but recommended)

Quick Start with Docker

1. Build the Docker Image

# Clone the repository
git clone https://github.com/ever-works/directory-web-template.git
cd directory-web-template

# Build the Docker image
docker build -t ever-works-website .

2. Run the Container

# Run the container
docker run -p 3000:3000 ever-works-website

Your site will be available at http://localhost:3000.

GitHub Actions Build and Publish

The root Dockerfile uses Turbo prune for this pnpm monorepo, builds only the @ever-works/web workspace and its dependencies, then copies the Next.js standalone output into a small runtime image. The repository includes separate branch-specific Docker publish workflows to build that image and publish it without deploying it.

Triggers

  • .github/workflows/docker-build-publish-dev.yml runs on develop and publishes directory-web-template-dev.
  • .github/workflows/docker-build-publish-stage.yml runs on stage and publishes directory-web-template-stage.
  • .github/workflows/docker-build-publish-prod.yml runs on main and publishes directory-web-template.
  • Each workflow also supports workflow_dispatch.

Each image receives latest and the 12-character commit SHA as tags.

Registries

GHCR is always enabled and uses the workflow GITHUB_TOKEN:

ghcr.io/<owner>/directory-web-template:latest
ghcr.io/<owner>/directory-web-template:<short-sha>

Docker Hub is enabled when these secrets are present:

  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN

Set the optional DOCKERHUB_NAMESPACE repository variable when the namespace differs from DOCKERHUB_USERNAME.

DigitalOcean Container Registry is enabled when DIGITALOCEAN_ACCESS_TOKEN is present. The registry name defaults to ever; set the DIGITALOCEAN_REGISTRY repository variable to override it.

For build-time Git CMS content, set DATA_REPOSITORY to the content repository name and GH_TOKEN to a token that can read it. GH_TOKEN is passed to Docker as a BuildKit secret rather than a build argument.

Docker Compose Setup

Create a docker-compose.yml file:

version: '3.8'

services:
app:
build: .
ports:
- '3000:3000'
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_BASE_URL=https://your-api.com
volumes:
- ./.content:/app/.content
restart: unless-stopped

# Optional: Add a database service
postgres:
image: postgres:15
environment:
POSTGRES_DB: everworks
POSTGRES_USER: user
POSTGRES_PASSWORD: password
volumes:
- postgres_data:/var/lib/postgresql/data
restart: unless-stopped

volumes:
postgres_data:

Run with Docker Compose

# Start all services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop services
docker-compose down

Environment Variables

Configure your deployment with environment variables:

# Required
NEXT_PUBLIC_API_BASE_URL=https://your-api.com
DATABASE_URL=postgresql://user:password@postgres:5432/everworks

# Optional
NEXTAUTH_SECRET=your-secret-key
NEXTAUTH_URL=https://your-domain.com

Production Considerations

Security

  • Use secrets management for sensitive data
  • Enable HTTPS with reverse proxy (nginx, Traefik)
  • Regular security updates

Performance

  • Use multi-stage builds to reduce image size
  • Configure proper resource limits
  • Enable caching layers

Monitoring

  • Add health checks
  • Configure logging
  • Set up monitoring and alerts

Next Steps