diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 4967c4a..ef38766 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -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"] diff --git a/webapp/next.config.js b/webapp/next.config.js index 357c3ce..902fb60 100644 --- a/webapp/next.config.js +++ b/webapp/next.config.js @@ -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'],