🚀 GitHub Actions CI/CD Pipeline: - Automatic Docker image builds on every push to main - Multi-platform support (Intel + Apple Silicon) - Images published to GitHub Container Registry (ghcr.io) - Tagged releases with semantic versioning - Build artifacts for easy deployment 📦 Deployment Options: - docker-compose.ghcr.yml for pre-built images (fastest) - Enhanced build-deploy.sh with 'local' and 'ghcr' modes - Comprehensive GITHUB_CONTAINER_REGISTRY.md guide - Updated README with quick deployment options 🏗️ Build Improvements: - Client build included in Docker image for nginx sharing - Automated GitHub Actions workflow with caching - Deployment artifacts generated automatically - Production docker-compose template creation ✅ Benefits: - 1-2 minute deployments (vs 5-10 minute local builds) - Consistent images across all environments - Automatic security scanning and multi-arch builds - Easy rollbacks with version tags - No local build dependencies required Usage: - Quick deploy: ./build-deploy.sh ghcr - Local build: ./build-deploy.sh local - View images: https://github.com/dlawler489/etsy-finance-tracker/pkgs/container/etsy-finance-tracker
82 lines
No EOL
2.1 KiB
YAML
82 lines
No EOL
2.1 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.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/health"]
|
|
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
|
|
- ./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
|
|
command: >
|
|
sh -c "
|
|
if [ ! -f /usr/share/nginx/html/index.html ]; then
|
|
echo 'Extracting client files...';
|
|
cp -r /app/client/dist/* /usr/share/nginx/html/ 2>/dev/null || true;
|
|
fi;
|
|
exec node server/index.js
|
|
"
|
|
|
|
# Optional: MongoDB for future database needs
|
|
# mongodb:
|
|
# image: mongo:6.0
|
|
# container_name: etsy-mongo
|
|
# ports:
|
|
# - "27017:27017"
|
|
# environment:
|
|
# MONGO_INITDB_ROOT_USERNAME: admin
|
|
# MONGO_INITDB_ROOT_PASSWORD: changeme
|
|
# volumes:
|
|
# - etsy_mongodb_data:/data/db
|
|
# networks:
|
|
# - etsy-network
|
|
# restart: unless-stopped
|
|
|
|
volumes:
|
|
etsy_uploads:
|
|
client_dist:
|
|
# etsy_mongodb_data:
|
|
|
|
networks:
|
|
etsy-network:
|
|
driver: bridge |