feat(frontend): Add Docker containerization support for development and production

Implement complete Docker setup for Next.js 16 frontend with multi-stage builds,
hot reload support, and production optimizations.

Changes:
- Add Dockerfile with multi-stage build (deps, builder, development, production)
- Add .dockerignore to exclude unnecessary files from Docker context
- Add .env.local.example template for environment configuration
- Update next.config.ts with standalone output for production builds
- Add Docker convenience scripts to package.json for easy container management
- Support hot reload in development with volume mounts
- Use Node.js 20 Alpine for smaller image size
- Implement security best practices (non-root user in production)

Technical Details:
- Development stage: Full source mounted with hot reload via Turbopack
- Production stage: Standalone build with optimized static assets
- Image size: ~1.17GB (development), smaller for production
- Port: 3000 (maps to container port 3000)

Testing:
- Docker build verified for development target
- Container startup successful with Next.js 16.0.1
- HTTP 200 response confirmed on localhost:3000
- Hot reload functional with volume mounts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-04 23:35:40 +01:00
parent 6c8ac6ee61
commit 75454b739b
5 changed files with 201 additions and 1 deletions

View File

@@ -7,7 +7,19 @@
"build": "next build",
"start": "next start",
"lint": "eslint",
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,md}\""
"format": "prettier --write \"**/*.{ts,tsx,js,jsx,json,css,md}\"",
"docker:dev": "docker-compose up -d postgres redis backend",
"docker:all": "docker-compose up -d",
"docker:stop": "docker-compose down",
"docker:logs": "docker-compose logs -f frontend",
"docker:logs:backend": "docker-compose logs -f backend",
"docker:logs:all": "docker-compose logs -f",
"docker:restart": "docker-compose restart frontend",
"docker:restart:backend": "docker-compose restart backend",
"docker:clean": "docker-compose down -v && docker-compose up -d --build",
"docker:status": "docker-compose ps",
"docker:build": "docker build --target development -t colaflow-frontend:dev .",
"docker:build:prod": "docker build --target production -t colaflow-frontend:prod ."
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",