Fix webapp container startup and configuration

This commit is contained in:
yznahmad 2025-06-20 03:43:21 +03:00
parent 78a37fba64
commit 51a4a2fbc6
2 changed files with 4 additions and 7 deletions

View File

@ -31,13 +31,12 @@ RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
# Copy the built application from the builder stage
COPY --from=deps /app/next.config.js .
COPY --from=deps /app/next.config.js ./
COPY --from=deps /app/public ./public
COPY --from=deps /app/package.json ./package.json
COPY --from=deps /app/package.json ./
# Copy .next/standalone
# Copy the standalone server and static files
COPY --from=deps --chown=nextjs:nodejs /app/.next/standalone ./
# Copy .next/static
COPY --from=deps --chown=nextjs:nodejs /app/.next/static ./.next/static
# Set the user to non-root
@ -52,5 +51,5 @@ ENV PORT 3000
# Use dumb-init to handle signals properly
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
# Start the application
# Set the command to run the application
CMD ["node", "server.js"]

View File

@ -5,8 +5,6 @@ const nextConfig = {
},
output: 'standalone',
experimental: {
// This is needed for Docker builds
outputFileTracingRoot: process.env.NODE_ENV === 'production' ? '../' : undefined,
// Disable server-side rendering for API routes during build
// to prevent database connection attempts
serverComponentsExternalPackages: ['mongoose'],