Docker Builds
Guide to building and deploying Docker images from the monorepo.
Overview
The monorepo produces three main Docker images:
| Image | Source | Purpose |
|---|---|---|
emprops/api | apps/api | Job Queue API server |
emprops/emprops-api | apps/emprops-api | EmProps REST API |
emprops/utils | apps/utils | Utility services |
Building Images
Build Individual Images
bash
# Build API image only
pnpm build:docker:api
# Build EmProps API image only
pnpm build:docker:emprops-api
# Build Utils image only
pnpm build:docker:utilsBuild and Push
bash
# Build and push to registry
pnpm build:docker:api:push
pnpm build:docker:emprops-api:push
pnpm build:docker:utils:pushBuild All Images
bash
# Build all images in parallel (faster)
pnpm build:docker:all
# Build and push all images
pnpm build:docker:all:pushBuild Process
The scripts/docker-build-api.js script handles the build process:
- Production Build - Runs
pnpm build:prodfirst (skipped for utils) - Prepare Docker - Runs
prepare-docker-build.jsin the app directory - Docker Build - Builds with
--platform linux/amd64 - Push (optional) - Pushes to registry and triggers Railway redeploy
Custom Tags
bash
# Build with custom tag
node scripts/docker-build-api.js api --tag v1.2.3
# Build with tag and push
node scripts/docker-build-api.js emprops-api --tag staging --push
# Build without cache
node scripts/docker-build-api.js api --no-cacheParallel Build Script
The build:docker:all command uses scripts/docker/build-all-parallel.sh which:
- Builds all three images concurrently
- Color-codes output per service (cyan/magenta/green)
- Fails fast if any build fails
- Reports final status
Machine Images
The GPU worker machine image has separate build commands:
bash
# Build machine image
pnpm machine:build
# Build and push machine image
pnpm machine:build:pushLocal Testing
After building, test images locally:
bash
# Pull latest (if using registry)
pnpm docker:api:pull
pnpm docker:emprops-api:pull
# Run locally
pnpm docker:api:run
pnpm docker:emprops-api:run
# Check health
pnpm docker:api:status
pnpm docker:emprops-api:statusBest Practices
- Always test locally before pushing to registry
- Use semantic tags for releases (v1.2.3)
- Use
latestonly for development/staging - Check health endpoints after deployment
- Monitor logs during initial rollout
