This project includes Docker Compose configuration for running the entire application stack locally.
- Docker (version 20.10+)
- Docker Compose (version 2.0+)
-
Clone the repository (if you haven't already):
git clone <repository-url> cd k8s-dashboard
-
Start the application:
docker-compose up -d
This will:
- Build the frontend and backend images
- Start PostgreSQL database
- Start the backend API server (port 3001)
- Start the frontend application (port 3000)
-
Access the application:
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- API Docs: http://localhost:3001/doc (if enabled)
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f postgresdocker-compose downdocker-compose down -vdocker-compose build --no-cachedocker-compose exec backend bun run db:migrate
docker-compose exec backend bun run db:pushDefault credentials are set in docker-compose.yml. For production, create a .env file based on .env.example:
cp .env.example .envThen customize the values:
POSTGRES_USER=your_user
POSTGRES_PASSWORD=your_secure_password
POSTGRES_DB=your_database_name
DATABASE_URL=postgresql://your_user:your_secure_password@postgres:5432/your_database_name- Container: postgres:16-alpine
- Port: 5432
- Volume:
postgres_data(persistent) - Health Check: Enabled
- Framework: Elysia (Bun runtime)
- Port: 3001
- Build: Multi-stage Dockerfile for optimized size
- Dependencies: Waits for PostgreSQL to be healthy
- Framework: React + Vite
- Port: 3000
- Build: Multi-stage build with http-server for static serving
- Dependencies: Waits for backend to be running
All services are connected via the k8s-dashboard-network bridge network, allowing services to communicate by service name (e.g., postgres:5432 from backend).
This Docker setup is configured for production. For development:
-
Run services individually with docker-compose:
docker-compose up postgres
-
Run frontend and backend locally:
# Terminal 1 - Frontend cd frontend npm run dev # Terminal 2 - Backend cd backend npm run dev
If ports 3000, 3001, or 5432 are already in use, modify the port mappings in docker-compose.yml:
ports:
- "3000:3000" # Change first number to use a different host port- Check PostgreSQL is running:
docker-compose logs postgres - Verify connection string in environment variables
- Ensure backend can reach postgres:
docker-compose exec backend ping postgres
Clear Docker cache and rebuild:
docker-compose down
docker system prune -a
docker-compose up --buildFor production deployment:
- Use strong passwords (update
.env) - Set
NODE_ENV=production - Use a reverse proxy (nginx) in front
- Enable proper logging and monitoring
- Set resource limits in docker-compose.yml
- Consider using managed database services instead of containerized PostgreSQL