feat: Add Docker containerization for consistent deployment

- Multi-stage Dockerfile with Node.js 20 Alpine base
- Production and development docker-compose configurations
- Health check API endpoint for container monitoring
- Build and deployment scripts with versioning support
- Port 3000 configuration for nginx compatibility
- Non-root user and security hardening
- Resource limits and logging configuration
- Package.json scripts for Docker operations

This eliminates dependency conflicts and provides reproducible deployments.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-07-12 18:47:36 -06:00
parent 086aa9de6d
commit 2e575f894e
8 changed files with 523 additions and 1 deletions

34
src/pages/api/health.ts Normal file
View File

@@ -0,0 +1,34 @@
import type { APIRoute } from 'astro';
export const GET: APIRoute = async () => {
try {
// Basic health check - could be extended to check database connectivity
const healthStatus = {
status: 'healthy',
timestamp: new Date().toISOString(),
version: process.env.npm_package_version || '1.0.0',
environment: process.env.NODE_ENV || 'development',
uptime: process.uptime()
};
return new Response(JSON.stringify(healthStatus), {
status: 200,
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
}
});
} catch (error) {
return new Response(JSON.stringify({
status: 'unhealthy',
timestamp: new Date().toISOString(),
error: error instanceof Error ? error.message : 'Unknown error'
}), {
status: 503,
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
}
});
}
};