build and testing environments as code tool
batect allows you to define your development tasks (building, running, testing, linting and more) in terms of one or more Docker containers, run those tasks quickly and consistently everywhere, and easily share them with your team.
🚀fast: Tasks start quickly due to parallelisation, run quickly thanks to caching, and clean up reliably every time - we've seen 17% quicker execution than Docker Compose.
😌easy to use: Easily share your development tasks with your whole team, and free them from manual setup of build tools and dependencies for tasks like running your app locally or integration testing. And no installation is required either - just drop the script in your project and batect takes care of the rest.
✨consistent: batect uses Docker to create a clean, isolated environment every time you run a task, freeing you from "works on my machine" issues - including on CI. And you can easily share tasks between projects with bundles.
✅versatile: Anything that can run in a Docker container can be run with batect - builds, unit testing, integration testing, linting, local environments, deployments; frontend, backend or somewhere in between, batect can do it all.
The simplest possible
containers: my-container: image: alpine:3.11.3 tasks: say-hello: description: Say hello to the nice person reading the batect README run: container: my-container command: echo 'Hello world!'
Run it with
$ ./batect say-hello Running say-hello... my-container: running echo 'Hello world!' Hello world! say-hello finished with exit code 0 in 1.2s.
Get a list of available tasks with
$ ./batect --list-tasks Available tasks: - say-hello: Say hello to the nice person reading the batect README
Take a look at the sample projects for more examples.
Download the latest version of
batect.cmdfrom the releases page, and copy them into your project.
Note that you only need the scripts - you don't need to download
batect.cmdscripts are designed to be committed alongside your project, and not installed globally. Committing them alongside your code improves consistency within your team, as everyone uses the same version of batect. They will automatically pull down the correct version of batect for your operating system.
If you're on Linux or macOS, make sure the script is executable: run
chmod +x batect.
batect.ymlto define your tasks and the environments they run in:
batect requires Docker 18.03.1 or newer, Java 8 or newer (although this requirement will be removed before v1.0), and:
- On Linux and macOS: Bash and
- On Windows: Windows 10 / Windows Server 2016 or later
batect supports both Linux and Windows containers.
A 64-bit version of Java is required on Windows.
Under the hood
Take a look at the task lifecycle to understand how batect executes tasks.
All documentation is available on the documentation site. Highlights include:
- Getting started guide
- Configuration file reference
- Sample projects
- Comparison with other tools
Dockerised local build and testing environments made easy at Container Camp AU (July 2019): video
Also presented at DevOpsDays Auckland (October 2019), DDD Sydney (September 2019) and DDD Melbourne (August 2019).
Support and community
There's a batect community on Spectrum - anyone is welcome to join.
Please open an issue on GitHub if you run into a problem or have a suggestion.
You can see what new features and improvements are planned in the roadmap.
Thank you to the following people for their bug reports, pull requests, suggestions and feedback, in alphabetical order:
- ...and everyone else who has used the tool and provided feedback offline