services: etsy-finance-tracker: build: . container_name: etsy-finance-tracker environment: - NODE_ENV=production - PORT=8080 ports: - "8080:8080" volumes: - ./data:/app/data - shared-volume:/shared healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"] interval: 30s timeout: 10s retries: 3 start_period: 40s command: > sh -c " echo '🚀 Starting Etsy Finance Tracker API Server...' && echo '📂 Current directory contents:' && ls -la && echo '📂 Client directory contents:' && ls -la client/ || echo 'No client directory found' && echo '📂 Client dist contents:' && ls -la client/dist/ || echo 'No client/dist directory found' && echo '📋 Creating shared directory...' && mkdir -p /shared && echo '📥 Attempting to copy client files...' && if [ -d 'client/dist' ]; then echo '✅ Found client/dist directory, copying...' && cp -rv client/dist/* /shared/ && echo '🎉 Client files copied successfully!' && ls -la /shared/ else echo '❌ No client/dist directory found. Building client...' && cd client && npm install && npm run build && cd .. && echo '📥 Copying newly built client files...' && cp -rv client/dist/* /shared/ && echo '🎉 Client files built and copied!' fi && echo '🚀 Starting Node.js server...' && node dist/index.js " restart: unless-stopped nginx: image: nginx:alpine container_name: etsy-nginx ports: - "8081:80" volumes: - ./nginx.deploy.conf:/etc/nginx/conf.d/default.conf - shared-volume:/usr/share/nginx/html depends_on: etsy-finance-tracker: condition: service_healthy command: > sh -c " echo '🌐 Starting nginx server...' && echo '📂 Checking shared volume contents:' && ls -la /usr/share/nginx/html/ && if [ ! -f '/usr/share/nginx/html/index.html' ]; then echo '⏳ Waiting for client files to be available...' && sleep 10 && ls -la /usr/share/nginx/html/ fi && echo '🚀 Starting nginx...' && nginx -g 'daemon off;' " restart: unless-stopped volumes: shared-volume: driver: local