-
Notifications
You must be signed in to change notification settings - Fork 0
Container Setup
This document provides an overview of the containerization setup for the TrueHour.
flight_budget/
βββ .github/
β βββ workflows/
β βββ docker-build.yml β
Build & push to Docker Hub + webhook
β βββ update-dependencies.yml β
Weekly CDN dependency updates
βββ data/
β βββ .gitkeep β
Placeholder for persistent volume
βββ libs/
β βββ papaparse.min.js β
19KB - CSV parsing library
β βββ chart.umd.min.js β
200KB - Chart visualization
β βββ html2pdf.bundle.min.js β
885KB - PDF export
βββ nginx/
β βββ nginx.conf β
Custom nginx config with security headers
βββ .dockerignore β
Optimize Docker build context
βββ .env.example β
Environment configuration template
βββ .gitignore β
Git exclusions
βββ DEPLOYMENT.md β
Portainer deployment guide
βββ docker-compose.yml β
Stack definition for Portainer
βββ Dockerfile β
Multi-stage nginx:alpine build
βββ index.html β
Updated to use local JS libraries
βββ README.md β
Complete documentation
-
Base Image:
nginx:alpine(~23MB) - Final Size: ~25-30MB (with all dependencies)
- Architecture: Multi-arch support (amd64, arm64)
- Security: Non-root user, security headers, health checks
- Optimization: Gzip compression, caching, minimal layers
- Downloaded and vendored 3 JavaScript libraries
- No external CDN dependencies required
- Automated weekly update checks via GitHub Actions
- Total library size: ~1.1MB
- GitHub Actions: Automated builds on push to main
- Docker Hub: Automatic image publishing
- Portainer: Webhook-triggered auto-deployment
- Build Time: ~2-3 minutes from commit to live
- Docker volume configured for aircraft data
- Volume persists across container updates
- TODO: Rewrite buggy aircraft persistence logic
- Environment-driven (
.envfile) - Port: 8181 (configurable)
- Timezone: UTC (configurable)
- Resource limits: 0.5 CPU / 128MB RAM
- README.md: Complete user and deployment guide
- DEPLOYMENT.md: Detailed Portainer setup instructions
- Inline comments in all configuration files
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Developer Experience β
β βββββββββββββββββ β
β β
β 1. git add . β
β 2. git commit -m "feat: new feature" β
β 3. git push origin main β
β β
β β
Done! Auto-deployed in 2-5 minutes β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Behind the Scenes β
β ββββββββββββββββββ β
β β
β GitHub Actions β
β β Download CDN libs (if needed) β
β β Build Docker image (amd64 + arm64) β
β β Push to Docker Hub β
β β Trigger Portainer webhook β
β β
β Portainer β
β β Receive webhook β
β β Pull latest image β
β β Redeploy stack (zero-downtime) β
β β
β β
Live on production! β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Spec | Value |
|---|---|
| Base Image | nginx:alpine |
| Final Size | ~30MB |
| Architecture | linux/amd64, linux/arm64 |
| Port (internal) | 80 |
| Port (host) | 8181 (configurable) |
| CPU Limit | 0.5 cores |
| Memory Limit | 128MB |
| Health Check | Every 30s via /health
|
| Restart Policy | unless-stopped |
| User | nginx (non-root) |
| Volume | flight-budget-data (persistent) |
β Container Security
- Runs as non-root user (nginx)
- Minimal attack surface (alpine base)
- No unnecessary packages installed
- Read-only filesystem where possible
β HTTP Security Headers
- X-Frame-Options: SAMEORIGIN
- X-Content-Type-Options: nosniff
- X-XSS-Protection: enabled
- Referrer-Policy: strict-origin-when-cross-origin
- Content-Security-Policy: configured
- Permissions-Policy: restricted
β Build Security
- Multi-stage build (coming in v2)
- .dockerignore prevents sensitive file inclusion
- No secrets in image layers
- Automated dependency updates
Edit .env or set in Portainer:
# Application port mapping (host:container)
APP_PORT=8181
# Container timezone
TIMEZONE=UTCTo customize resources, edit docker-compose.yml:
deploy:
resources:
limits:
cpus: '1.0' # Increase CPU
memory: 256M # Increase memoryEdit nginx/nginx.conf for:
- Custom cache policies
- Additional security headers
- Rate limiting
- Access controls
curl http://localhost:8181/health
# Response: "healthy"# Via Docker
docker logs -f flight-budget-app
# Via Portainer
Stacks β flight-budget β Logs# Access logs
docker exec flight-budget-app tail -f /var/log/nginx/access.log
# Error logs
docker exec flight-budget-app tail -f /var/log/nginx/error.log- Push code to main branch
- GitHub Actions builds and pushes image
- Portainer webhook auto-deploys
- Zero manual intervention required
# Pull latest image
docker pull ryakel/flight-budget:latest
# Recreate container
docker-compose up -d --force-recreate# Via Portainer: Use "Redeploy" with previous image tag
# Via CLI: Use specific tag
docker-compose pull ryakel/flight-budget:main-abc1234
docker-compose up -d --force-recreateβ Gzip compression (6x ratio) β Static asset caching (1 year) β HTML no-cache (always fresh) β Minimal image size (~30MB) β Multi-arch support (native performance) β Resource limits (prevents runaway)
- Add CDN for static assets
- Implement service worker for offline
- Add Redis for session management
- Implement rate limiting
- Aircraft persistence logic is buggy - needs rewrite
- Current: Uses localStorage (client-side only)
- Planned: Use Docker volume + backend API
- See:
index.html:456-461for current implementation
- Add proper error handling for file uploads
- Implement user authentication (optional)
- Add analytics/telemetry (optional)
- Add dark mode
- Improve mobile responsiveness
- Add unit tests
# 1. Build image locally
docker build -t ryakel/flight-budget:test .
# 2. Run container
docker run -d -p 8181:80 --name test-flight-budget ryakel/flight-budget:test
# 3. Test health endpoint
curl http://localhost:8181/health
# 4. Open in browser
open http://localhost:8181
# 5. Cleanup
docker stop test-flight-budget
docker rm test-flight-budget- Deploy to staging environment first
- Verify health check passes
- Test file upload (CSV import)
- Test save/load budget functionality
- Verify PDF export works
- Check nginx logs for errors
- Monitor resource usage
- Deploy to production
- β Complete initial setup (DONE)
- β¬ Create GitHub repository
- β¬ Push code to GitHub
- β¬ Add GitHub secrets (Docker Hub + Portainer webhook)
- β¬ Deploy stack in Portainer
- β¬ Configure nginx reverse proxy
- β¬ Set up SSL with Let's Encrypt
- β¬ Fix aircraft persistence logic
- β¬ Test automated deployment workflow
- β¬ Go live! π
Setup completed on: 2025-11-27
Docker Image: ryakel/flight-budget:latest
Repository: ryakel/flight-budget (to be created)
Maintainer: ryakel
π View on GitHub | π³ Docker Hub
π Report Issue | π¬ Discussions
License: MIT License | Copyright (c) 2024-2025 FliteAxis
π Getting Started
π¦ Deployment
π§ Development
π Security
- Security Setup Guide
- Security CI/CD Pipeline
- Code Quality & Linting
- SBOM Management
- Vulnerability Scanning
π Dependencies
π³ Docker
π Reference
π Links