- Configure Vite to split vendor chunks (React, DOMPurify, video libs, Supabase) - Add manual chunk configuration to prevent duplicate module bundling - Clean Docker build cache and node_modules cache during build - Update Dockerfile to force clean rebuilds This should resolve the 'Identifier already declared' error in production caused by DOMPurify's @xmldom dependency being bundled multiple times. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
47 lines
1.1 KiB
Docker
47 lines
1.1 KiB
Docker
# Build stage
|
|
FROM node:18-alpine AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies with clean install
|
|
RUN npm ci --prefer-offline --no-audit --force
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Clean any previous build artifacts and node_modules cache, then build
|
|
RUN rm -rf dist node_modules/.cache && npm run build
|
|
|
|
# Production stage - Use a simple server that works with Coolify
|
|
FROM node:18-alpine AS production
|
|
|
|
# Install curl and serve package
|
|
RUN apk add --no-cache curl && npm install -g serve
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy built assets from builder stage
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S nodejs
|
|
RUN adduser -S nextjs -u 1001
|
|
|
|
# Change ownership
|
|
RUN chown -R nextjs:nodejs /app
|
|
USER nextjs
|
|
|
|
# Expose port 80 (to match Caddy configuration)
|
|
EXPOSE 80
|
|
|
|
# Add healthcheck
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:80/ || exit 1
|
|
|
|
# Start the server
|
|
CMD ["serve", "-s", "dist", "-l", "80"] |