- Remove redundant export statements from workflow - Add default values to Docker Compose environment variables - Add debugging logs to help diagnose deployment issues - Ensure environment variables are properly passed to containers This should resolve the 'variable is not set' warnings and make the main page accessible.
97 lines
2.5 KiB
YAML
97 lines
2.5 KiB
YAML
# Unified Docker Compose configuration for Portfolio
|
|
# Supports both local development and production deployment
|
|
|
|
services:
|
|
portfolio:
|
|
image: portfolio-app:latest
|
|
container_name: portfolio-app
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${PORT:-3000}:3000" # Configurable port, defaults to 3000
|
|
environment:
|
|
- NODE_ENV=${NODE_ENV:-production}
|
|
- DATABASE_URL=postgresql://portfolio_user:portfolio_pass@postgres:5432/portfolio_db?schema=public
|
|
- REDIS_URL=redis://redis:6379
|
|
- NEXT_PUBLIC_BASE_URL=${NEXT_PUBLIC_BASE_URL:-https://dk0.dev}
|
|
- MY_EMAIL=${MY_EMAIL:-contact@dk0.dev}
|
|
- MY_INFO_EMAIL=${MY_INFO_EMAIL:-info@dk0.dev}
|
|
- MY_PASSWORD=${MY_PASSWORD:-your-email-password}
|
|
- MY_INFO_PASSWORD=${MY_INFO_PASSWORD:-your-info-email-password}
|
|
- ADMIN_BASIC_AUTH=${ADMIN_BASIC_AUTH:-admin:your_secure_password_here}
|
|
volumes:
|
|
- portfolio_data:/app/.next/cache
|
|
networks:
|
|
- portfolio_net
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 512M
|
|
cpus: '0.5'
|
|
reservations:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: portfolio-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
- POSTGRES_DB=portfolio_db
|
|
- POSTGRES_USER=portfolio_user
|
|
- POSTGRES_PASSWORD=portfolio_pass
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- portfolio_net
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U portfolio_user -d portfolio_db"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
cpus: '0.25'
|
|
reservations:
|
|
memory: 128M
|
|
cpus: '0.1'
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: portfolio-redis
|
|
restart: unless-stopped
|
|
volumes:
|
|
- redis_data:/data
|
|
networks:
|
|
- portfolio_net
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
volumes:
|
|
portfolio_data:
|
|
driver: local
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
portfolio_net:
|
|
driver: bridge |