refactor: update Dockerfile and docker-compose.yml for Next.js 16 optimization and improved build process
This commit is contained in:
+49
-14
@@ -1,26 +1,61 @@
|
||||
# docker-compose.yml
|
||||
version: "3.8"
|
||||
# =============================================================================
|
||||
# Docker Compose - Production Configuration for Coolify
|
||||
# =============================================================================
|
||||
# Optimized for:
|
||||
# - Fast cold starts
|
||||
# - Minimal resource usage
|
||||
# - Zero-downtime deployments
|
||||
# - Coolify compatibility
|
||||
# =============================================================================
|
||||
|
||||
services:
|
||||
frontend:
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
# Enable BuildKit for faster builds and layer caching
|
||||
args:
|
||||
- NODE_ENV=${NODE_ENV}
|
||||
- DEV_MODE=${DEV_MODE}
|
||||
- NEXT_TELEMETRY_DISABLED=1
|
||||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
- NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID}
|
||||
- NEXT_PUBLIC_CLIENT_SECRET=${NEXT_PUBLIC_CLIENT_SECRET}
|
||||
- BUILDKIT_INLINE_CACHE=1
|
||||
- DOCKER_BUILDKIT=1
|
||||
# Cache strategy for faster rebuilds
|
||||
cache_from:
|
||||
- node:20-alpine
|
||||
|
||||
# Container restart policy
|
||||
restart: unless-stopped
|
||||
|
||||
# Dynamic port mapping (Coolify manages external port)
|
||||
ports:
|
||||
- "${APP_PORT}:3000"
|
||||
- "3000"
|
||||
|
||||
# Environment variables
|
||||
# Note: Coolify injects these automatically from project settings
|
||||
environment:
|
||||
- NEXT_TELEMETRY_DISABLED=1
|
||||
- DEV_MODE=${DEV_MODE}
|
||||
# Node.js
|
||||
- NODE_ENV=${NODE_ENV:-production}
|
||||
- PORT=3000
|
||||
- HOSTNAME=0.0.0.0
|
||||
- DEV_MODE=false
|
||||
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
- NEXT_PUBLIC_CLIENT_ID=${NEXT_PUBLIC_CLIENT_ID}
|
||||
- NEXT_PUBLIC_CLIENT_SECRET=${NEXT_PUBLIC_CLIENT_SECRET}
|
||||
- APP_PORT=${APP_PORT}
|
||||
- NODE_ENV=${NODE_ENV}
|
||||
|
||||
# Resource limits (optimized for low traffic sites)
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.5"
|
||||
memory: 512M
|
||||
reservations:
|
||||
cpus: "0.1"
|
||||
memory: 128M
|
||||
|
||||
# Networks (Coolify uses bridge network)
|
||||
networks:
|
||||
- coolify
|
||||
|
||||
# Network configuration
|
||||
networks:
|
||||
coolify:
|
||||
driver: bridge
|
||||
external: true
|
||||
|
||||
Reference in New Issue
Block a user