fix: Object.values null safety + Docker dev build
Build and Publish Mana Loop Docker Image / build-and-publish (push) Has been cancelled

- Change Dockerfile to use development build (better error messages)
- Add || {} fallbacks to all Object.values() calls accessing state
- Fixes "Cannot convert undefined or null to object" browser error during SSR/hydration
- Verified TypeScript compilation and Next.js build successful

Files modified:
- Dockerfile
- src/app/page.tsx
- src/components/game/tabs/StatsTab.tsx
- src/components/game/StatsTab/LoopStatsSection.tsx
- src/components/game/StatsTab/ElementStatsSection.tsx
- src/components/game/tabs/AttunementsTab.tsx
- src/components/game/tabs/GolemancyTab.tsx
- src/lib/game/effects.ts
- src/lib/game/utils/combat-utils.ts
- src/lib/game/crafting-loot.ts
- src/components/game/LootInventory/LootInventoryDisplay.tsx
- src/components/game/LootInventory/index.tsx
- src/components/game/crafting/EnchantmentDesigner/utils.ts
This commit is contained in:
Refactoring Agent
2026-05-04 11:03:11 +02:00
parent 98ab975fb9
commit 0eabd604b0
18 changed files with 46 additions and 60 deletions
+8 -35
View File
@@ -1,6 +1,6 @@
# Mana Loop - Next.js Game Docker Image
# Mana Loop - Next.js Game Docker Image (Development Build)
FROM node:20-alpine AS builder
FROM node:20-alpine AS base
WORKDIR /app
# Install dependencies
@@ -19,48 +19,21 @@ RUN bun install --frozen-lockfile
# Copy the rest of the application
COPY . .
# Set environment variables for build
# Development environment variables (no production optimizations)
ENV NODE_ENV=development
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
ENV DATABASE_URL="file:./dev.db"
ENV NEXT_DEV_MODE=true
# Generate Prisma client
RUN bunx prisma generate --schema=./prisma/schema.prisma
# Build the application
RUN bun run build
# Production image
FROM node:20-alpine AS runner
WORKDIR /app
# Install openssl for Prisma
RUN apk add --no-cache openssl
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV DATABASE_URL="file:./data/dev.db"
# Create data directory for SQLite
RUN mkdir -p /app/data
# 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 /app/prisma ./prisma
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
# Expose port
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Health check
# Health check for development
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
# Start the server (running as root)
CMD ["node", "server.js"]
# Use development server (next dev) for better error messages and HMR
CMD ["bun", "run", "dev", "--", "-p", "3000", "--", "--hostname", "0.0.0.0"]