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:
34
src/pages/api/health.ts
Normal file
34
src/pages/api/health.ts
Normal 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'
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user