Overview
WhatDoc does not currently include official Docker support out of the box, but you can easily containerize the application yourself. This guide provides production-ready Dockerfiles and docker-compose configuration for self-hosting.Prerequisites
- Docker 20.10+
- Docker Compose 2.0+
- MongoDB (local or cloud instance)
- At least 2GB RAM
- Valid Gemini API key(s)
Quick Start with Docker Compose
Create the following files in your project root:1. Server Dockerfile
Createserver/Dockerfile:
2. Client Dockerfile
Createclient/Dockerfile:
3. Nginx Configuration
Createclient/nginx.conf:
4. Docker Compose Configuration
Createdocker-compose.yml in the project root:
5. Environment Configuration
Create.env in the project root:
[!WARNING] Never commit the.envfile to version control. Add it to.gitignoreimmediately.
Deployment
1. Build and Start Services
2. Verify Services
3. Monitor Logs
Production Considerations
Reverse Proxy Setup
For production, use a reverse proxy like Traefik or Nginx:SSL/TLS Configuration
For HTTPS support:- Obtain SSL certificates (Let’s Encrypt recommended)
- Mount certificates in the nginx service
- Update
nginx-prod.confwith SSL directives
Resource Limits
Add resource constraints to prevent memory issues:Health Checks
Add health checks for automatic restarts:Maintenance
Update Application
Backup Database
Restore Database
Clean Up
Troubleshooting
Server Won’t Start
-
Check environment variables:
-
Verify MongoDB connection:
-
Check server logs:
Client Build Fails
- Ensure build args are passed correctly
- Check Vite configuration
- Verify Node.js version (18+)
Git Clone Failures
The server needs git installed and write access to/tmp:
[!TIP] For large repos, increase Docker’s storage allocation in Docker Desktop settings (Disk image size).
Alternative: Single Container
For smaller deployments, combine server and client:start.sh:
