Skip to content

A simple yet powerful docker base to use when starting new projects.

Notifications You must be signed in to change notification settings

kent-h/simple-docker-build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Docker Build

A simple yet powerful docker base to use when starting new projects.

Supported Languages

Features

  • 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 cache
      • Dockerfile 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

Usage

  1. Copy the build.sh script from this project to the root of your project.
  2. Change the first few lines of the build script NAME="", REPO="" to use the desired docker image tag.
  3. Copy the Dockerfile, .dockerignore, and any other relevant files from the relevant spellbooks/{language}/ to the root of your project.
  4. Follow any instructions in spellbooks/{language}/README.md

    Test by running ./build.sh

Also recommended:

  1. Update .dockerignore to include project-specific ignores.
  2. Check and update pinned versions in the Dockerfile.

Contributing

When adding Dockerfiles for a new language, spellbooks/template/... should be used as a general guide.

About

A simple yet powerful docker base to use when starting new projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published