etsy-finance-tracker/docker-compose.deploy.yml
dlawler489 5db29f7a26 Update deployment compose file for container interfaces
🔧 Container Interface Deployment Fix:
- Use nginx.deploy.conf for deployment-specific nginx config
- Add command to copy client files to shared volume
- Improve startup logging and error handling
- Ensure client files are available to nginx container

 Deployment Ready:
- Works with Portainer, Docker Desktop, and similar interfaces
- Copies React build files from API container to nginx volume
- Proper container startup sequence and health checks
- Clear logging for troubleshooting startup issues

This fixes the missing client files issue when deploying from container management interfaces.
2026-04-21 09:20:38 +10:00

85 lines
No EOL
2.4 KiB
YAML

version: '3.8'
services:
# Nginx reverse proxy and static file server
nginx:
image: nginx:alpine
container_name: etsy-nginx
ports:
- "3000:80"
volumes:
- ./nginx.deploy.conf:/etc/nginx/nginx.conf:ro
- client_dist:/usr/share/nginx/html:ro
depends_on:
- etsy-tracker
restart: unless-stopped
networks:
- etsy-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
# Etsy Finance Tracker API Server (from GitHub Container Registry)
etsy-tracker:
image: ghcr.io/dlawler489/etsy-finance-tracker:main
container_name: etsy-finance-tracker
expose:
- "8080"
environment:
- NODE_ENV=production
- PORT=8080
- CLIENT_URL=http://nginx
volumes:
# Mount data directory for persistent storage
- etsy_data:/app/data
# Optional: Mount uploads directory if needed
- etsy_uploads:/app/uploads
# Share client build with nginx
- client_dist:/usr/share/nginx/html
restart: unless-stopped
networks:
- etsy-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Copy client files to shared volume and start server
command: >
sh -c "
echo 'Starting Etsy Finance Tracker API Server...';
if [ ! -f /usr/share/nginx/html/index.html ]; then
echo 'Copying client files to shared volume...';
cp -r /app/client/dist/* /usr/share/nginx/html/ 2>/dev/null || true;
echo 'Client files copied successfully';
fi;
echo 'Starting Node.js server...';
exec node server/dist/index.js
"
command: >
sh -c "
echo 'Starting Etsy Finance Tracker...';
if [ ! -f /usr/share/nginx/html/index.html ]; then
echo 'Extracting client files to shared volume...';
cp -r /app/client/dist/* /usr/share/nginx/html/ 2>/dev/null || true;
echo 'Client files extracted successfully';
fi;
echo 'Starting API server on port 8080...';
exec node server/dist/index.js
"
volumes:
etsy_uploads:
driver: local
client_dist:
driver: local
etsy_data:
driver: local
networks:
etsy-network:
driver: bridge