From 7a493d0e9cab7c0c4f53915f540f6d48b963f2c4 Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 21 Dec 2025 23:26:46 +0700 Subject: [PATCH] Update Dockerfile for Coolify compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- Dockerfile | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index c44b9ba..0a2073a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app # Copy package files COPY package*.json ./ -# Install dependencies (including dev dependencies for build) +# Install dependencies RUN npm ci # Copy source code @@ -16,32 +16,28 @@ COPY . . # Build the application RUN npm run build -# Production stage -FROM nginx:alpine AS production +# Production stage - Use a simple server that works with Coolify +FROM node:18-alpine AS production -# Copy custom nginx configuration -COPY nginx.conf /etc/nginx/conf.d/default.conf +# Install serve package +RUN npm install -g serve + +# Set working directory +WORKDIR /app # Copy built assets from builder stage -COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /app/dist ./dist -# Create non-root user (optional but recommended for security) +# Create non-root user RUN addgroup -g 1001 -S nodejs RUN adduser -S nextjs -u 1001 -# Change ownership of the nginx directory -RUN chown -R nextjs:nodejs /usr/share/nginx/html -RUN chown -R nextjs:nodejs /var/cache/nginx -RUN chown -R nextjs:nodejs /var/log/nginx -RUN chown -R nextjs:nodejs /etc/nginx/conf.d -RUN touch /var/run/nginx.pid -RUN chown -R nextjs:nodejs /var/run/nginx.pid - -# Switch to non-root user +# Change ownership +RUN chown -R nextjs:nodejs /app USER nextjs -# Expose port 80 -EXPOSE 80 +# Expose port 3000 (Coolify default) +EXPOSE 3000 -# Start nginx -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +# Start the server +CMD ["serve", "-s", "dist", "-l", "3000"] \ No newline at end of file