Fix webapp container startup and configuration
This commit is contained in:
parent
78a37fba64
commit
51a4a2fbc6
@ -31,13 +31,12 @@ RUN addgroup --system --gid 1001 nodejs
|
|||||||
RUN adduser --system --uid 1001 nextjs
|
RUN adduser --system --uid 1001 nextjs
|
||||||
|
|
||||||
# Copy the built application from the builder stage
|
# 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/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 --from=deps --chown=nextjs:nodejs /app/.next/standalone ./
|
||||||
# Copy .next/static
|
|
||||||
COPY --from=deps --chown=nextjs:nodejs /app/.next/static ./.next/static
|
COPY --from=deps --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||||
|
|
||||||
# Set the user to non-root
|
# Set the user to non-root
|
||||||
@ -52,5 +51,5 @@ ENV PORT 3000
|
|||||||
# Use dumb-init to handle signals properly
|
# Use dumb-init to handle signals properly
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
|
||||||
|
|
||||||
# Start the application
|
# Set the command to run the application
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|||||||
@ -5,8 +5,6 @@ const nextConfig = {
|
|||||||
},
|
},
|
||||||
output: 'standalone',
|
output: 'standalone',
|
||||||
experimental: {
|
experimental: {
|
||||||
// This is needed for Docker builds
|
|
||||||
outputFileTracingRoot: process.env.NODE_ENV === 'production' ? '../' : undefined,
|
|
||||||
// Disable server-side rendering for API routes during build
|
// Disable server-side rendering for API routes during build
|
||||||
// to prevent database connection attempts
|
// to prevent database connection attempts
|
||||||
serverComponentsExternalPackages: ['mongoose'],
|
serverComponentsExternalPackages: ['mongoose'],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user