Fix build by preventing MongoDB connections during build
This commit is contained in:
parent
afe5528a1b
commit
0256b96365
@ -13,6 +13,8 @@ COPY webapp/ .
|
|||||||
# Set environment variables for build
|
# Set environment variables for build
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
# Use a dummy DB_URI during build to prevent connection attempts
|
||||||
|
ENV DB_URI=mongodb://dummy:password@localhost:27017/dummy
|
||||||
|
|
||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|||||||
@ -11,6 +11,14 @@ const nextConfig = {
|
|||||||
// to prevent database connection attempts
|
// to prevent database connection attempts
|
||||||
serverComponentsExternalPackages: ['mongoose'],
|
serverComponentsExternalPackages: ['mongoose'],
|
||||||
},
|
},
|
||||||
|
// Disable server-side rendering during build for specific pages that require DB access
|
||||||
|
// This prevents connection attempts during build
|
||||||
|
exportPathMap: async function() {
|
||||||
|
return {
|
||||||
|
'/': { page: '/dashboard' },
|
||||||
|
// Add other static pages here
|
||||||
|
};
|
||||||
|
},
|
||||||
async redirects() {
|
async redirects() {
|
||||||
return [
|
return [
|
||||||
{ // we redirect '/' to '/dashboard
|
{ // we redirect '/' to '/dashboard
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user