- Replace Nginx with serve package for SPA compatibility - Use port 3000 to match Coolify's default configuration - Works better with Coolify's Caddy reverse proxy setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
43 lines
759 B
Docker
43 lines
759 B
Docker
# Build stage
|
|
FROM node:18-alpine AS builder
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage - Use a simple server that works with Coolify
|
|
FROM node:18-alpine AS production
|
|
|
|
# Install serve package
|
|
RUN 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 3000 (Coolify default)
|
|
EXPOSE 3000
|
|
|
|
# Start the server
|
|
CMD ["serve", "-s", "dist", "-l", "3000"] |