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
This commit is contained in:
nmemmert committed 2025-10-22 13:10:27 -04:00
1 parent aa2c28d444
commit 08ca9ed7da
2 files changed
+10 -11

No files matched your search

+8 -9
View File
@@ -16,20 +16,19 @@ RUN npm ci
# Copy source code # Copy source code
COPY . . COPY . .
# Next.js collects completely anonymous telemetry data about general usage. # Set environment for build
# Learn more here: https://nextjs.org/telemetry ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during the build. ENV NEXT_TELEMETRY_DISABLED=1
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 # Production image, copy all the files and run next
FROM base AS runner FROM base AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV production ENV NODE_ENV=production
# Uncomment the following line in case you want to disable telemetry during runtime. # 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 addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs RUN adduser --system --uid 1001 nextjs
@@ -49,9 +48,9 @@ USER nextjs
EXPOSE 3000 EXPOSE 3000
ENV PORT 3000 ENV PORT=3000
# set hostname to localhost # 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 # server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output # https://nextjs.org/docs/pages/api-reference/next-config-js/output
+2 -2
View File
@@ -6,8 +6,8 @@ const nextConfig: NextConfig = {
/* config options here */ /* config options here */
}; };
const config = process.env.NODE_ENV === 'production' ? withPWA({ const config = withPWA({
dest: 'public', dest: 'public',
})(nextConfig) : nextConfig; })(nextConfig);
export default config; export default config;