Overview
Watch N Chill includes production-ready Docker configurations for containerized deployments. The application uses a multi-stage Dockerfile for optimized image size and includes health checks for reliability.Quick Start
Using Pre-built Image
Pull and run the production image with Docker Compose:Access the application at http://localhost:3000
Docker Compose Configurations
Development (docker-compose.yml)
Builds the application from source with local Redis:Dockerfile Breakdown
The multi-stage Dockerfile optimizes the final image size:Dockerfile
Image Features
Multi-stage Build
Separate stages for deps, build, and runtime reduce final image size
Alpine Linux
Uses
node:20-alpine for minimal footprint (~150MB final image)Non-root User
Runs as
nextjs user (UID 1001) for securityStandalone Output
Next.js standalone mode bundles only required dependencies
Environment Configuration
Using .env File
Create a.env file alongside docker-compose.yml:
.env
Using External Redis
To use a hosted Redis instance (like Upstash) instead of the container:docker-compose.yml
Running Commands
Start Services
Stop Services
View Logs
Execute Commands
Health Checks
Application Health Check
The app container includes a health check that polls the/health endpoint:
Redis Health Check
Volume Management
Redis Data Persistence
Redis data is persisted in a Docker volume:Building Custom Images
Build Locally
Push to Registry
Networking
Docker Compose creates a default network for service communication:- App container: Accessible at
http://localhost:3000 - Redis container: Accessible internally at
redis:6379 - Redis external: Accessible at
localhost:6380(dev) orlocalhost:6379(prod)
Custom Network
Troubleshooting
Container Won’t Start
Port Already in Use
Change the port mapping indocker-compose.yml:
Redis Connection Failed
Health Check Failing
Production Considerations
Resource Limits
Next Steps
Environment Variables
Configure all environment options
Production Deployment
Deploy to cloud platforms