From 4389091095bc5d6418719b6f49104751b53c61c6 Mon Sep 17 00:00:00 2001 From: mukeshs Date: Fri, 10 Oct 2025 00:44:24 +0530 Subject: [PATCH] Docker update --- DockerFile | 20 +++++++++++++++++--- next.config.ts | 14 +++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/DockerFile b/DockerFile index bd8eb7a..4a90b0f 100644 --- a/DockerFile +++ b/DockerFile @@ -27,10 +27,24 @@ WORKDIR /app # Set to production ENV NODE_ENV=production -# Copy necessary files +# Create nextjs user and group +RUN addgroup --system --gid 1001 nodejs && \ + adduser --system --uid 1001 nextjs + +# Copy necessary files from builder COPY --from=builder /app/public ./public -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +# Create cache directory and set permissions +RUN mkdir -p .next/cache/images && \ + chown -R nextjs:nodejs .next + +# Ensure the entire app directory has proper permissions +RUN chown -R nextjs:nodejs /app + +# Switch to non-root user +USER nextjs # Expose port EXPOSE 3000 diff --git a/next.config.ts b/next.config.ts index 2c7c1e8..0e7d39a 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,6 +1,8 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { + // Required for Docker standalone build + output: 'standalone', /* config options here */ images: { @@ -19,12 +21,18 @@ const nextConfig: NextConfig = { }, { protocol: 'https', - hostname: 'yourproductiondomain.com', // Replace with your production domain + hostname: 'cmcbackend.rootwire.com', pathname: '/api/files/images/**', + }, + { + protocol: 'https', + hostname: 'maincmc.rootwire.com', + pathname: '/**', } ], - + // Minimize cache issues in production + minimumCacheTTL: 60, }, }; -export default nextConfig; +export default nextConfig; \ No newline at end of file