Docker Setup

The eTeamups Platform uses Docker and Docker Compose for both local development and production deployment. This document covers the Compose files, image building process, service definitions, and container management.

Docker Compose Files

The project maintains two Docker Compose configurations:

File Purpose
docker-compose.yml Production – pulls pre-built images from GHCR
docker-compose.local.yml Local development – runs only MongoDB and Redis

Production: docker-compose.yml

The production Compose file defines all platform services using pre-built images from GHCR. Every application service depends on MongoDB and Redis being healthy before starting.

Local Development: docker-compose.local.yml

The local development Compose file starts only the infrastructure containers (MongoDB and Redis) with the same configuration as production. Application services are run directly on the host using ts-node for hot reload during development.

# Start local infrastructure
docker compose -f docker-compose.local.yml up -d

# Run application services with hot reload
npx ts-node src/auth-service/index.ts

Building Docker Images

Dockerfile

The project uses a single multi-stage Dockerfile at the repository root:

  • Base image: node:20-alpine
  • Build steps: Copies source code, installs dependencies, compiles TypeScript
  • Output: Optimized production image with only compiled JavaScript and production dependencies

Build and Push Scripts

# Build all service images locally
./scripts/docker-build.sh

# Push built images to GHCR
./scripts/docker-push.sh

GHCR Authentication

Before pulling or pushing images, authenticate with GitHub Container Registry:

docker login ghcr.io -u <GITHUB_USERNAME> --password-stdin <<< "<GITHUB_PERSONAL_ACCESS_TOKEN>"

The token requires the read:packages scope for pulling and write:packages for pushing.

Production Service Definitions

Infrastructure Services

MongoDB

mongodb:
  image: mongo:7-jammy
  ports:
    - "27018:27017"
  volumes:
    - mongodb_data:/data/db
  healthcheck:
    test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]

Port 27018 is exposed on the host to avoid conflicts with any local MongoDB installation. The health check uses mongosh to verify the database is accepting connections.

Redis

redis:
  image: redis:7-alpine
  ports:
    - "6379:6379"
  volumes:
    - redis_data:/data

Redis is configured with AOF (Append Only File) persistence. Memory is capped at 512MB via configuration.

Application Services

Service Image Port Notes
auth-service ghcr.io/creativeaura/auth-service 9000 Authentication and JWT
profile-service ghcr.io/creativeaura/profile-service 9100 User profiles
organisation-service ghcr.io/creativeaura/organisation-service 9107 Organisation management
media-service ghcr.io/creativeaura/media-service 9102 File uploads, media_uploads volume
message-queue-service ghcr.io/creativeaura/message-queue-service BullMQ background worker
admin-portal ghcr.io/creativeaura/admin-portal 9103 Admin interface
zeswa-hub ghcr.io/creativeaura/zeswa-hub 4000 Frontend application

Nginx

nginx:
  ports:
    - "80:80"
    - "443:443"
    - "18443:18443"
  depends_on:
    - auth-service
    - profile-service
    - organisation-service
    - media-service
    - admin-portal
    - zeswa-hub

Nginx starts only after all upstream application services are running.

Docker Volumes

Volume Purpose
mongodb_data MongoDB data persistence
redis_data Redis AOF persistence
media_uploads User-uploaded media files
nginx_logs Nginx access and error logs

Container Management Scripts

The scripts/ directory provides convenience wrappers for common Docker operations:

Script Description
scripts/docker-start.sh Start all containers
scripts/docker-stop.sh Stop all containers
scripts/docker-build.sh Build all Docker images
scripts/docker-push.sh Push images to GHCR