Quick Start
Building the Image
Build the Docker image from the project root:Running the Container
Run Budgetron with the minimum required environment variables:Docker Architecture
Multi-Stage Build
The Dockerfile uses a four-stage build process for optimal image size and security:Stage 0: Base Image
gcompatfor compatibility with certain Node.js native modulespostgresql-clientfor thepg_isreadyhealth check utility
Stage 1: Dependencies
Stage 2: Builder
Stage 3: Runtime
Container Startup Process
When the container starts, the entrypoint script (entrypoint.sh) performs the following sequence:
1. Database Health Check
MAX_WAIT environment variable) for the database to be ready.
2. Database Migration
3. Server Start
Port Configuration
Budgetron exposes port 3000 by default. You can customize this in two ways:Build-time Configuration
Runtime Port Mapping
Volume Mounts
Budgetron is stateless and doesn’t require persistent volumes. All data is stored in PostgreSQL. For local development with file watching, you can mount the source directory:Environment Variables
See the complete list of environment variables in the configuration section.Essential Variables
These must be provided at runtime:Optional Variables
Configure additional features:Docker Compose Example
While Budgetron doesn’t include adocker-compose.yml file, here’s a recommended setup:
Health Checks
Implement Docker health checks for better orchestration:Image Registry
Budgetron publishes official Docker images to GitHub Container Registry:latest- Latest stable releasev0.1.0- Specific versionmaster- Latest commit on master branch
Troubleshooting
Container Exits Immediately
Check the database connection:DB_URL is correct and the database is accessible.
Migration Failures
If migrations fail, you can run them manually:Permission Issues
The container runs as root by default. For better security, create a non-root user:CMD instruction in your Dockerfile.
Increase Database Wait Time
If your database takes longer to start:Next Steps
- Self-Hosting Guide - Deploy on your own infrastructure
- Production Setup - Production hardening and best practices
- Environment Variables - Complete configuration reference