https://github.com/AlexXi19/bardock

Intro

Frequently, Docker builds are closely integrated with CI/CD processes, leading to the use of less readable and less reusable shell scripts within CI/CD YAML configurations. This approach often lacks an effective high level visualization of the relevant services and the locations of their corresponding Dockerfiles.

Moreover, managing the contexts of various Dockerfiles can be troublesome especially for monorepos. For example, in a pnpm workspace monorepo setup, the service needs to include relevant package directories that might not necessarily be in the subdirectory of the Dockerfile, which means that you must place the Dockerfile in the root of the monorepo or run the docker build command in a directory different from the Dockerfile, which can be messy and hard to manage.

Bardock is a monorepo Dockerfile management tool that allows you to manage, build, and push Dockerfiles with a declarative syntax.

In addition to Dockerfile management, Bardock also provides configurations to customize your image build and push process, like using the github commit sha as the image tag.

To use Bardock, You create a file called bardock.yaml in the root of your repository.

# bardock.yaml
services:
  service1:
    dockerfile: ./service1/Dockerfile
    image_name: service1
    build_context: ./service1
 
  service2:
    dockerfile: ./service2/Dockerfile
    image_name: service2
    push: false
 
config:
  registry_url: alexxi19
  image_tag: latest

This bardock.yaml file specifies your services and their corresponding Dockerfiles, image names, and other information.

With this bardock.yaml spec file, we simply just run bardock service1 to build and push the image for service1.

More information about Bardock can be found in the README.md in the repository.