feat: optimize docker compose for dashboard and api (#578)
* chore: use turbo for build * fix docker compose file and remove backend * chore: update .dockerignore to include additional files and directories for improved build management * copy everything in both docke filed * refactor: streamline Dockerfile to copy entire dashboard app and remove unnecessary node_modules references * update api to use turbo to start * run ls la for docker files * update cmd commands * update cmds to use node * fix: add redis url to docker compose * fix: reduce memory allocation for dashboard build in Dockerfile * debug dashboard build * update api docker file * update dashboard * add tsconfig * chore: add echo to dockerfile * fix: change echo to run * chore: install pnpm before switching to non-root user in Dockerfile * refactor: update start commands in package.json and Dockerfiles to use pnpm * install turbo * use turbo 1.10.16 * update turbo config * fix: update CMD in Dockerfile to run the API directly using Node.js * change * add commands to turbo.json * copy over turbo * add workspace * fix: update start commands in package.json to specify ports for dashboard and API * publish docker images * add dev branch * update compose * build only for amd64 platform * refactor: update docker-compose to use pre-built images and remove build context * coolify-dockertest * point to latest * chore: update docker-compose to use specific version tags for API and dashboard images * remove envs for docker file * 0.1.3 * use dynamic env * 0.1.4 * add PUBLIC_IS_SELFHOSTED=true * chore: update docker-compose to use version 0.1.5 for API and dashboard images * use static for PUBLIC_IS_SELFHOSTED * disable cache for tag * use 0.1.7 * add PUBLIC_IS_SELFHOSTED=true * comment out caching * update docker-compose to use version 0.1.8 for API and dashboard images * update api port * use tag 0.1.9 * add cache * use latest tag in compose file
This commit is contained in:
@@ -0,0 +1,141 @@
|
||||
# Docker Usage Guide
|
||||
|
||||
This directory contains all Docker-related files for the ClassroomIO project.
|
||||
|
||||
## 📁 Directory Structure
|
||||
|
||||
```
|
||||
docker/
|
||||
├── README.md # Full publishing guide
|
||||
├── USAGE.md # This file - quick usage guide
|
||||
├── commands.md # Quick command reference
|
||||
├── docker-compose.yaml # Docker Compose configuration
|
||||
├── docker-push.sh # Script to publish images to Docker Hub
|
||||
├── Dockerfile.api # API service Dockerfile
|
||||
└── Dockerfile.dashboard # Dashboard service Dockerfile
|
||||
```
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Using Docker Compose (Recommended)
|
||||
|
||||
```bash
|
||||
# From the project root
|
||||
cd docker
|
||||
docker-compose up -d
|
||||
|
||||
# Or from project root
|
||||
docker-compose -f docker/docker-compose.yaml up -d
|
||||
```
|
||||
|
||||
### Building Individual Images
|
||||
|
||||
```bash
|
||||
# From project root
|
||||
docker build -f docker/Dockerfile.api -t api .
|
||||
docker build -f docker/Dockerfile.dashboard -t dashboard .
|
||||
```
|
||||
|
||||
## 📦 Publishing to Docker Hub
|
||||
|
||||
```bash
|
||||
# From project root
|
||||
./docker/docker-push.sh
|
||||
|
||||
# With custom options
|
||||
DOCKERHUB_USERNAME=your-username VERSION=v1.0.0 ./docker/docker-push.sh
|
||||
```
|
||||
|
||||
## 🔧 Common Commands
|
||||
|
||||
### Start Services
|
||||
```bash
|
||||
cd docker && docker-compose up -d
|
||||
```
|
||||
|
||||
### Stop Services
|
||||
```bash
|
||||
cd docker && docker-compose down
|
||||
```
|
||||
|
||||
### View Logs
|
||||
```bash
|
||||
cd docker && docker-compose logs -f
|
||||
```
|
||||
|
||||
### Rebuild Services
|
||||
```bash
|
||||
cd docker && docker-compose up -d --build
|
||||
```
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
- **README.md**: Complete Docker Hub publishing guide
|
||||
- **commands.md**: Quick command reference
|
||||
- **GitHub Actions**: Automated publishing via `.github/workflows/docker-publish.yml`
|
||||
|
||||
## 🌍 Environment Variables
|
||||
|
||||
Copy `.env.example` to `.env` in the project root and configure:
|
||||
|
||||
```bash
|
||||
cp ../.env.example ../.env
|
||||
```
|
||||
|
||||
Required variables are listed in `docker-compose.yaml`.
|
||||
|
||||
## 🔗 Published Images
|
||||
|
||||
- **API**: `classroomio/api` or `classroomio/api`
|
||||
- **Dashboard**: `classroomio/dashboard` or `classroomio/dashboard`
|
||||
|
||||
Pull from Docker Hub:
|
||||
```bash
|
||||
docker pull classroomio/api:latest
|
||||
docker pull classroomio/dashboard:latest
|
||||
```
|
||||
|
||||
## 💡 Tips
|
||||
|
||||
1. **Always run builds from project root** - the context needs to be the entire monorepo
|
||||
2. **Use docker-compose** for local development
|
||||
3. **Use published images** for production deployments
|
||||
4. **Check logs** if services fail to start: `docker-compose logs -f`
|
||||
|
||||
## 🐛 Troubleshooting
|
||||
|
||||
### Services won't start
|
||||
```bash
|
||||
# Check logs
|
||||
docker-compose logs -f
|
||||
|
||||
# Rebuild from scratch
|
||||
docker-compose down
|
||||
docker-compose build --no-cache
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Port conflicts
|
||||
```bash
|
||||
# Check if ports are in use
|
||||
lsof -i :3081 # API
|
||||
lsof -i :3082 # Dashboard
|
||||
|
||||
# Change ports in docker-compose.yaml if needed
|
||||
```
|
||||
|
||||
### Build failures
|
||||
```bash
|
||||
# Clean up Docker
|
||||
docker system prune -a
|
||||
|
||||
# Try building again
|
||||
docker-compose build --no-cache
|
||||
```
|
||||
|
||||
## 📞 Support
|
||||
|
||||
For more detailed information, see:
|
||||
- `README.md` - Full Docker Hub publishing guide
|
||||
- `commands.md` - Quick command reference
|
||||
- Project main README for general setup
|
||||
Reference in New Issue
Block a user