- Added serverRuntimeConfig to next.config.ts for improved server-side configuration.
- Updated gitea-deploy.sh to include additional environment variables for deployment.
- Increased sleep duration and health check timeout for better container readiness verification.
- Implemented checks to ensure the container is running during health checks and logs container status if it fails.
✅ Enhancements improve deployment reliability and server configuration management.
68 lines
1.5 KiB
TypeScript
68 lines
1.5 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import dotenv from "dotenv";
|
|
import path from "path";
|
|
|
|
// Lade die .env Datei aus dem Arbeitsverzeichnis
|
|
dotenv.config({ path: path.resolve(__dirname, '.env') });
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Enable standalone output for Docker
|
|
output: 'standalone',
|
|
outputFileTracingRoot: path.join(__dirname, '../../'),
|
|
|
|
// Ensure proper server configuration
|
|
serverRuntimeConfig: {
|
|
// Will only be available on the server side
|
|
},
|
|
|
|
// Optimize for production
|
|
compress: true,
|
|
poweredByHeader: false,
|
|
|
|
// Disable ESLint during build for Docker
|
|
eslint: {
|
|
ignoreDuringBuilds: process.env.NODE_ENV === 'production',
|
|
},
|
|
|
|
// Environment variables
|
|
env: {
|
|
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL
|
|
},
|
|
|
|
// Performance optimizations
|
|
experimental: {
|
|
optimizePackageImports: ['lucide-react', 'framer-motion'],
|
|
},
|
|
|
|
// Image optimization
|
|
images: {
|
|
formats: ['image/webp', 'image/avif'],
|
|
minimumCacheTTL: 60,
|
|
},
|
|
|
|
// Dynamic routes are handled automatically by Next.js
|
|
|
|
// Add cache-busting headers
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: '/(.*)',
|
|
headers: [
|
|
{
|
|
key: 'Cache-Control',
|
|
value: 'public, max-age=0, must-revalidate',
|
|
},
|
|
],
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
import bundleAnalyzer from "@next/bundle-analyzer";
|
|
|
|
const withBundleAnalyzer = bundleAnalyzer({
|
|
enabled: process.env.ANALYZE === "true",
|
|
});
|
|
|
|
module.exports = withBundleAnalyzer(nextConfig);
|