Dockerλ︎
Docker containers an isolated environment for repeatable build & runtime systems.
Dockerfile configuration defines a consistent approach to building the source code of project locally, or within a continuous integration (CI) system.
Designing a Dockerfile
configuration to maximise use of image overlays (layers) greatly enhances the speed of the build, as libraries and other unchanged assets are cached on first run.
Docker compose orchestrates multiple services locally. Heath checks and conditions can be set to ensure dependant services start in the correct order.
Docker compose can use a Dockerfile
configuration to build a project when starting services. An on-watch
feature can rebuild the project from sourcw when code changes are written to file.
Recommended Docker Images
- alpine linux or debian linux as the base operating system
- Clojure - official Docker Clojure image
- Eclipse Temurin - Offical Docker image for OpenJDK
Docker and Clojure projects
A Docker Compose workflow complements the Clojure REPL Driven Development workflow.
A REPL connected editor provides instant feedback on the code as it is written, with Docker Compose providing a consistent build and orchestration of services.
General Workflowλ︎
- Install Docker Desktop & Extensions
- Select a Docker image as a base or builder stage
- Create a Dockerfile, e.g a multi-stage build and run-time Dockerfile
- Compose services together, adding health checks and conditional starts
- (optional) Automatic rebuild of Clojure project when watching for code changes (experimental feature)
Try the Docker getting started tutorial
Follow the Docker Getting Started tutorial from within Docker Desktop or via the command line.
Practicalli Project Templates includes docker configuration
Practicalli Project Templates create projects that include a multi-stage Dockerfile
, .dockerignore
and compose.yaml
configurations for Clojure development.