I’m happy to share my (updated) Docker project boilerplate templates for greenfielding new projects. These are updated versions of the previous Ruby and Node boilerplates. I plan to maintain these and add new languages as my experience grows. Hopefully I can add Python, Go, and Java ones soon enough. Pull requests accepted as always.
The boilerplates are built on
docker-compose. Each boilerplate includes:
- Docker based dependency management
- TDD setup
- Code linting
- An editorconfig file configured for best practices
- Dockerfile configured to run a web server
- Blackbox & whitebox tests for the web server
make test-ci: Run a full battery of tests
make test-smoke: Run a smoke test against production process
They generally follow the same structure.
docker is used to generate dependencies so they can be committed to source control. This removes upstream dependencies on upstream package hosts at build time.
docker-compose manages containers for various other targets. One container runs the process (the boilerplates use a simple web server as a common case). Another container is used for quick tests (for interpreted languages which don’t require a separate compile step). Another container is used to smoke test the application container.
I hope these boilerplates help you bootstrap new Docker project.
Good luck out there and happy shipping!