Skip to content

dele-work/cobol-docker-template

Repository files navigation

cobol-docker

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.

Quick Start

# Build and run
make build
make prod

# Development shell (with compiler)
make dev

# Run tests
make test

Project Layout

src/main/           COBOL source programs
src/copybooks/      Shared COPY members
scripts/            Build, run, and test helpers
data/               Sample data files
tests/              Shell-based test suite

Profiles

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 Targets

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

Sample Programs

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

Security

  • Non-root user (cobol, UID 1000)
  • Read-only root filesystem (prod)
  • tmpfs /tmp with 10MB cap
  • CPU and memory limits (1 core / 256MB)
  • Minimal package footprint — runtime image has no compiler or build chain

Requirements

  • Docker >= 24.0
  • Docker Compose V2

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors