Production-ready GnuCOBOL development and runtime environment using Docker.
Multi-stage builds keep the runtime image small (~140MB) by shipping only the COBOL runtime library — no compiler, no build tools.
# Build and run
make build
make prod
# Development shell (with compiler)
make dev
# Run tests
make testsrc/main/ COBOL source programs
src/copybooks/ Shared COPY members
scripts/ Build, run, and test helpers
data/ Sample data files
tests/ Shell-based test suite
| Profile | Image | Use case |
|---|---|---|
prod |
Dockerfile (multi-stage) |
Runtime only. Read-only rootfs, resource limits, non-root user. |
dev |
Dockerfile.dev |
Full compiler + debug flags. Source mounted via bind mount. |
test |
Dockerfile.dev |
Runs test suite and exits. |
make build Build production image
make prod Run production container
make dev Start development shell
make test Run test suite
make lint Syntax-check all COBOL sources
make clean Remove containers and images
make shell Attach to running dev container
make logs Tail production logs
hello — Prints current date, time, and environment info.
batch-report — Reads a transaction file, aggregates credits/debits, and prints a summary report. Set INPUT_FILE to use a custom data file.
docker compose --profile prod run --rm prod /app/scripts/run.sh batch-report- Non-root user (
cobol, UID 1000) - Read-only root filesystem (prod)
tmpfs /tmpwith 10MB cap- CPU and memory limits (1 core / 256MB)
- Minimal package footprint — runtime image has no compiler or build chain
- Docker >= 24.0
- Docker Compose V2
MIT