A simple yet powerful docker base to use when starting new projects.
- 100% Docker (avoiding extraneous build dependencies)
- Workspace non-polluting (no bind-mounting of local folders, etc.)
- Efficient
- Utilizes build stages to create a minimal final container.
- Non-source files & development directories are excluded by
.dockerignore
. - Utilizes the
docker build
cacheDockerfile
build dependencies are processed from least-to-most volatile, to best utilize docker's build caching.- Pinned code dependencies are downloaded/built separately from project code.
- Versioned
- Repeatable builds.
- The following variables are injected into the docker build process. Dockerfiles SHOULD expose these variables to the final executable in the final container.
BRANCH_NAME
COMMIT_NUMBER
(counted from the initial commit)GIT_COMMIT
(a hash)GIT_UNCOMMITTED_CHANGES
(a git working tree modified flag)
- A build initiated with a clean git repository, will result in an image with a tag of the form:
$REPO$NAME:0.$COMMIT_NUMBER
(if on the master branch)
or
$REPO$NAME:$BRANCH_NAME-0.$COMMIT_NUMBER
(if on any other branch).
Though not truly SemVer-compliant, this is easily SemVer-compatible.
Builds initiated with a non-clean git repository will simply be tagged as:$REPO$NAME:latest
- Copy the build.sh script from this project to the root of your project.
- Change the first few lines of the build script
NAME=""
,REPO=""
to use the desired docker image tag. - Copy the
Dockerfile
,.dockerignore
, and any other relevant files from the relevantspellbooks/{language}/
to the root of your project. - Follow any instructions in
spellbooks/{language}/README.md
Test by running./build.sh
Also recommended:
- Update
.dockerignore
to include project-specific ignores. - Check and update pinned versions in the Dockerfile.
When adding Dockerfiles for a new language, spellbooks/template/...
should be used as a general guide.