Files
Gan, Jimmy 6c0d5a4e63 Initial commit: Clean Mold Cost Calculator application
- Flask-based mold cost calculation application
- PostgreSQL database with SQLAlchemy ORM
- Docker/Podman containerization
- Comprehensive documentation in docs/
- Clean, organized codebase without obsolete files
- Production-ready deployment configuration
- Enhanced pytest configuration with coverage reporting
- Master/Development branch structure
2025-06-24 02:30:09 +08:00

91 lines
2.1 KiB
YAML

version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
container_name: mold_cost_tool
ports:
- "5002:5002"
env_file:
- .env
environment:
- FLASK_APP=run.py
- FLASK_ENV=production
- LOG_LEVEL=INFO
- LOG_TO_STDOUT=True
volumes:
- ./logs:/app/logs
- ./instance:/app/instance
depends_on:
db:
condition: service_healthy
restart: unless-stopped
networks:
- mold_network
db:
image: docker.io/library/postgres:14-alpine
container_name: mold_cost_db
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=mold_cost
volumes:
- postgres_data:/var/lib/postgresql/data
- ./deploy/db/init:/docker-entrypoint-initdb.d
ports:
- "5433:5432"
restart: unless-stopped
networks:
- mold_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
backup:
image: docker.io/library/postgres:14-alpine
container_name: mold_cost_backup
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=mold_cost
volumes:
- ./backups:/backups
- ./deploy/db/backup.sh:/backup.sh
- ./deploy/db/restore.sh:/restore.sh
depends_on:
db:
condition: service_healthy
networks:
- mold_network
command: >
sh -c "
chmod +x /backup.sh /restore.sh &&
echo 'Starting backup service...' &&
echo 'Creating initial backup...' &&
/backup.sh &&
echo 'Setting up daily backups at 2 AM...' &&
while true; do
# Wait until 2 AM
current_hour=\$(date +%H)
if [ \$current_hour -eq 2 ]; then
echo 'Creating scheduled daily backup...' &&
/backup.sh
fi
# Sleep for 1 hour and check again
sleep 3600
done
"
restart: unless-stopped
volumes:
postgres_data:
name: mold_cost_postgres_data
networks:
mold_network:
name: mold_cost_network