From 08ca9ed7da22365f30bbbc46b4e33cd1fa53af7c Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Wed, 22 Oct 2025 13:10:27 -0400 Subject: [PATCH] Fix Docker build issues - Fix ENV format warnings in Dockerfile - Set NODE_ENV=production during build - Enable PWA plugin for all environments to ensure consistent builds - Add debugging for build failures --- Dockerfile | 17 ++++++++--------- next.config.ts | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 146bfb3..c26e4fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,20 +16,19 @@ RUN npm ci # Copy source code COPY . . -# Next.js collects completely anonymous telemetry data about general usage. -# Learn more here: https://nextjs.org/telemetry -# Uncomment the following line in case you want to disable telemetry during the build. -ENV NEXT_TELEMETRY_DISABLED 1 +# Set environment for build +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 -RUN npm run build +RUN npm run build || (echo "Build failed, showing logs:" && cat /tmp/build.log 2>/dev/null || echo "No build log found" && exit 1) # Production image, copy all the files and run next FROM base AS runner WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # Uncomment the following line in case you want to disable telemetry during runtime. -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_TELEMETRY_DISABLED=1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs @@ -49,9 +48,9 @@ USER nextjs EXPOSE 3000 -ENV PORT 3000 +ENV PORT=3000 # set hostname to localhost -ENV HOSTNAME "0.0.0.0" +ENV HOSTNAME="0.0.0.0" # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output diff --git a/next.config.ts b/next.config.ts index 02e0844..958753e 100644 --- a/next.config.ts +++ b/next.config.ts @@ -6,8 +6,8 @@ const nextConfig: NextConfig = { /* config options here */ }; -const config = process.env.NODE_ENV === 'production' ? withPWA({ +const config = withPWA({ dest: 'public', -})(nextConfig) : nextConfig; +})(nextConfig); export default config;