โ FULLY FUNCTIONAL: Complete container management with optimized builds and background execution
# Build and run with Bun (recommended)
./manage c update Dockerfile.bun-optimized
# Build and run with Node.js
./manage c update Dockerfile
# View logs
./manage c logs
# Stop container
./manage c stop
Dockerfile - Node.js runtime (production ready)Dockerfile.bun-clean - Bun runtime (faster, modern)| Command | Usage | Description |
|---|---|---|
| build | ./manage c build [Dockerfile] |
Build Docker image only |
| run | ./manage c run [Dockerfile] |
Build and run container (with cleanup prompt) |
| update | ./manage c update [Dockerfile] |
Full update (build + run + cleanup prompt) |
| stop | ./manage c stop |
Stop and remove container |
| logs | ./manage c logs |
View container logs (Ctrl+C to exit) |
| shell | ./manage c shell |
Open shell in running container |
| cleanup | ./manage c cleanup |
Interactive cleanup with multiple options |
| prune | ./manage c prune |
System prune (remove unused resources) |
| help | ./manage c help |
Show detailed help |
After successful run or update commands, the system automatically prompts for cleanup with these options:
flash-legal:1.0.0-bun)Each build automatically creates multiple tags for the same image:
Node.js Runtime (Dockerfile):
flash-legal:1.0.1 - Version-specific (recommended for production)flash-legal:latest - Generic latest (default)flash-legal:stable - Stable version identifierflash-legal:node - Runtime identifierBun Runtime (Dockerfile.bun-clean):
flash-legal:1.0.1-bun - Version + runtime (recommended)flash-legal:latest-bun - Latest Bun versionflash-legal:bun - Generic Bun identifierflash-legal:1.0.1-latest - Version + latest comboBenefits:
bun or latestThis will prompt you to:
1. Select action (build, run, update, etc.)
2. Choose Dockerfile if needed
3. Automatically handle the rest
### Direct Commands
```bash
# Build specific image
./manage c build Dockerfile.bun-clean
# Update (build + run)
./manage c update Dockerfile
# Container management
./manage c stop # Stop container
./manage c logs # View logs (press Ctrl+C to exit)
./manage c shell # Open shell in running container
./manage c cleanup # Remove everything
โ NEVER DO THIS (blocks terminal):
podman run --rm -p 3000:3000 flash-legal:1.0.0-bun
โ ALWAYS DO THIS (runs in background):
podman run -d --name flash-legal --network host --env-file apps/flash-legal/.env flash-legal:1.0.0-bun
Our scripts automatically use background mode (-d flag) to prevent terminal blocking.
The script automatically detects and uses:
--network host-p 3000:3000flash-law/
โโโ manage # Main entry point
โโโ scripts/
โ โโโ container.sh # Container management logic
โ โโโ CONTAINER_COMMANDS.md # This documentation
โ โโโ DOCKER_OPTIMIZATION_RESULTS.md # Performance results
โโโ apps/flash-legal/
โโโ Dockerfile # Node.js runtime
โโโ Dockerfile.bun-clean # Bun runtime
โโโ .env # Required environment file
./manage c logs # Check container logs
# Clean build (no cache)
podman system prune -f
./manage c build
Make sure apps/flash-legal/.env exists with required variables:
DATABASE_URI=mongodb://127.0.0.1:27017/flash-legal
PAYLOAD_SECRET=your-secret-here
NEXT_PUBLIC_SERVER_URL=http://localhost:3000
--network host for DB)./manage container for new users./manage c logs to monitor health./manage c cleanup to free space# Direct Podman commands
podman build -f apps/flash-legal/Dockerfile.bun-clean -t flash-legal:1.0.0-bun .
podman run -d --name flash-legal --network host --env-file apps/flash-legal/.env flash-legal:1.0.0-bun
# Check status
podman ps --filter "name=flash-legal"
podman logs flash-legal
The container script supports:
Remember: Always run containers in background mode to avoid terminal interruption!
cd /mnt/repo/Turbo/flash-law
podman build -f apps/flash-legal/Dockerfile -t flash-legal:latest .
cd /mnt/repo/Turbo/flash-law
docker build -f apps/flash-legal/Dockerfile -t flash-legal:latest .
podman stop flash-legal-app && podman rm flash-legal-app
docker stop flash-legal-app && docker rm flash-legal-app
cd /mnt/repo/Turbo/flash-law/apps/flash-legal
podman run -d --network host --name flash-legal-app --env-file .env flash-legal:latest
cd /mnt/repo/Turbo/flash-law/apps/flash-legal
docker run -d -p 3000:3000 --name flash-legal-app --env-file .env flash-legal:latest
# Stop and remove existing container
podman stop flash-legal-app && podman rm flash-legal-app
# Build new image
cd /mnt/repo/Turbo/flash-law
podman build -f apps/flash-legal/Dockerfile -t flash-legal:latest .
# Run new container
cd /mnt/repo/Turbo/flash-law/apps/flash-legal
podman run -d --network host --name flash-legal-app --env-file .env flash-legal:latest
# Stop and remove existing container
docker stop flash-legal-app && docker rm flash-legal-app
# Build new image
cd /mnt/repo/Turbo/flash-law
docker build -f apps/flash-legal/Dockerfile -t flash-legal:latest .
# Run new container
cd /mnt/repo/Turbo/flash-law/apps/flash-legal
docker run -d -p 3000:3000 --name flash-legal-app --env-file .env flash-legal:latest
# Podman
podman logs flash-legal-app
podman logs -f flash-legal-app # Follow logs
# Docker
docker logs flash-legal-app
docker logs -f flash-legal-app # Follow logs
# Podman
podman ps | grep flash-legal-app
# Docker
docker ps | grep flash-legal-app
# Podman
podman exec -it flash-legal-app /bin/sh
# Docker
docker exec -it flash-legal-app /bin/sh
curl http://localhost:3000
curl -I http://localhost:3000/_next/static/css/b1a328a2eeb8cc11.css
cd /mnt/repo/Turbo/flash-law && podman stop flash-legal-app; podman rm flash-legal-app; podman build -f apps/flash-legal/Dockerfile -t flash-legal:latest . && cd apps/flash-legal && podman run -d --network host --name flash-legal-app --env-file .env flash-legal:latest
cd /mnt/repo/Turbo/flash-law && docker stop flash-legal-app; docker rm flash-legal-app; docker build -f apps/flash-legal/Dockerfile -t flash-legal:latest . && cd apps/flash-legal && docker run -d -p 3000:3000 --name flash-legal-app --env-file .env flash-legal:latest
# Podman
podman stop flash-legal-app && podman rm flash-legal-app
podman rmi flash-legal:latest
podman system prune -f
# Docker
docker stop flash-legal-app && docker rm flash-legal-app
docker rmi flash-legal:latest
docker system prune -f
# Check static files location
podman exec flash-legal-app ls -la /app/.next/static/
docker exec flash-legal-app ls -la /app/.next/static/
# Check environment variables
podman exec flash-legal-app printenv | grep -E "(DATABASE_URI|PAYLOAD_SECRET)"
docker exec flash-legal-app printenv | grep -E "(DATABASE_URI|PAYLOAD_SECRET)"
# For Docker, if MongoDB connection fails, use host network:
docker run -d --network host --name flash-legal-app --env-file .env flash-legal:latest
If you prefer Docker Compose, use the provided docker-compose.prod.yml:
# With Docker Compose
docker-compose -f docker-compose.prod.yml up -d --build
# Update with Docker Compose
docker-compose -f docker-compose.prod.yml down
docker-compose -f docker-compose.prod.yml up -d --build
Make sure your .env file contains:
DATABASE_URI=mongodb://127.0.0.1:27017/flash-legal
PAYLOAD_SECRET=your-secret-here
NEXT_PUBLIC_SERVER_URL=http://localhost:3000
PREVIEW_SECRET=your-preview-secret
CRON_SECRET=your-cron-secret
--network host for database access, Docker uses -p 3000:3000-f flag to follow logs in real-time