Docker update

This commit is contained in:
2025-10-10 00:44:24 +05:30
parent 58ea820e14
commit 4389091095
2 changed files with 28 additions and 6 deletions

View File

@ -27,10 +27,24 @@ WORKDIR /app
# Set to production # Set to production
ENV NODE_ENV=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/public ./public
COPY --from=builder /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static 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 port
EXPOSE 3000 EXPOSE 3000

View File

@ -1,6 +1,8 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
// Required for Docker standalone build
output: 'standalone',
/* config options here */ /* config options here */
images: { images: {
@ -19,11 +21,17 @@ const nextConfig: NextConfig = {
}, },
{ {
protocol: 'https', protocol: 'https',
hostname: 'yourproductiondomain.com', // Replace with your production domain hostname: 'cmcbackend.rootwire.com',
pathname: '/api/files/images/**', pathname: '/api/files/images/**',
},
{
protocol: 'https',
hostname: 'maincmc.rootwire.com',
pathname: '/**',
} }
], ],
// Minimize cache issues in production
minimumCacheTTL: 60,
}, },
}; };