Prerequisites
Install Docker on your system:- Linux
- macOS
- Windows
Docker Compose Architecture
SkyTeam uses Docker Compose to orchestrate multiple services. The configuration is defined indocker-compose.yml:
docker-compose.yml
Service Overview
Admin Panel
Port: 3001
Tech: Next.js
Image: Built from
Tech: Next.js
Image: Built from
apps/admin/DockerfileAPI Server
Port: 4000
Tech: Express
Image: Built from
Tech: Express
Image: Built from
apps/api/DockerfileDiscord Bot
Port: None
Tech: Discord.js
Image: Built from
Tech: Discord.js
Image: Built from
apps/client/DockerfileWeb Frontend
Port: 3000
Tech: Next.js
Image: Built from
Tech: Next.js
Image: Built from
apps/web/DockerfileService Configuration Details
Admin Panel Service
docker-compose.yml
NODE_ENV- Set to productionDATABASE_URL- PostgreSQL connection stringNEXT_PUBLIC_API_URL- Public API endpointADMIN_JWT_SECRET- JWT signing secret
unless-stopped - Restarts automatically except when manually stopped
API Server Service
docker-compose.yml
NODE_ENV- Production modeDATABASE_URL- Database connectionPORT- API server port (4000)ADMIN_JWT_SECRET- JWT verification secret
Discord Bot Service
docker-compose.yml
DISCORD_TOKEN- Bot authentication tokenDISCORD_HOME_GUILD_ID- Discord server IDDISCORD_CLIENT_ID- Discord application ID
Web Frontend Service
docker-compose.yml
NEXT_PUBLIC_API_URL- API endpoint for browser
Deployment Steps
Build Docker Images
Build all service images:This will:
- Build each Dockerfile
- Install dependencies with pnpm 10.5.2
- Compile TypeScript to JavaScript
- Create optimized production images
Start All Services
Launch all containers:The
-d flag runs containers in detached mode (background).Verify all services are running:
Initialize Database
Push database schema (one-time setup):Or connect to your external database and run migrations.
Verify Deployment
Check service health:
- Web: http://localhost:3000
- Admin: http://localhost:3001
- API: http://localhost:4000/health (if implemented)
Docker Commands Reference
Dockerfile Structure
Each service uses a multi-stage Dockerfile for optimized builds. Example fromapps/api/Dockerfile:
apps/api/Dockerfile
- Multi-stage build - Separates build and runtime environments
- Layer caching - Optimizes rebuild times
- Production-only deps - Smaller image size
- Node 20 Alpine - Minimal base image (~150MB vs 1GB)
Network Configuration
Services communicate via theskyteam-network bridge network:
docker-compose.yml
- Services can reference each other by service name
- Example: API can connect to
http://web:3000
- Only mapped ports are accessible from host
- Ports 3000, 3001, 4000 exposed to host machine
Production Deployment
Using External Database
For production, use a managed PostgreSQL service:- Supabase
- AWS RDS
- Neon
.env
Environment-Specific Configs
Create separate compose files:docker-compose.prod.yml
Health Checks
Add health checks to services:docker-compose.yml
Reverse Proxy (Production)
Use Nginx or Traefik as reverse proxy:docker-compose.yml
Monitoring & Logs
View Logs
Container Stats
Log Management
Configure log rotation:/etc/docker/daemon.json
Troubleshooting
Build fails with dependency errors
Build fails with dependency errors
Clear Docker cache and rebuild:
Service won't start
Service won't start
Check logs for errors:Common issues:
- Missing environment variables
- Port conflicts (check with
netstat -tuln) - Database connection failures
Cannot connect to services
Cannot connect to services
Verify network configuration:Check if services are on the same network.
Out of disk space
Out of disk space
Clean up unused Docker resources:
Hot reload not working in development
Hot reload not working in development
Docker volumes may have sync issues. Use bind mounts in dev:
docker-compose.dev.yml
Security Best Practices
Use Secret Management
Don’t store secrets in
.env files in production. Use:- Docker secrets
- AWS Secrets Manager
- HashiCorp Vault
- Environment variables from CI/CD
Next Steps
Configuration
Configure environment variables
Development
Start developing features