diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9627542..8531b34 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -48,10 +48,10 @@ RUN adduser --system --uid 1001 nextjs # Copy node_modules from deps stage COPY --from=deps /app/node_modules ./node_modules -# Copy built application +# Copy built application (standalone output) COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/package.json ./package.json +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static # Set the correct permission for prerender cache RUN chown -R nextjs:nodejs .next @@ -64,5 +64,5 @@ EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" -# Start the application -CMD ["npm", "start"] \ No newline at end of file +# Start the application (standalone) +CMD ["node", "server.js"] \ No newline at end of file diff --git a/frontend/next.config.js b/frontend/next.config.js index e70c81f..279e0a5 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -10,12 +10,20 @@ const nextConfig = { ignoreBuildErrors: true, }, experimental: { + // Enable standalone output for better Docker compatibility + outputStandalone: true, }, - webpack: (config) => { + webpack: (config, { isServer, dev }) => { config.resolve.alias = { ...config.resolve.alias, - '@': require('path').resolve(__dirname, 'src'), + '@': require('path').join(__dirname, 'src'), }; + + // Optional: Add debug logging + if (dev) { + console.log('Webpack alias config:', config.resolve.alias); + } + return config; }, env: {