/dmux

Docker multiplexer.

Primary LanguageGoApache License 2.0Apache-2.0

dmux

Build Status Go Report Card

Making multi-repository builds simple.

Install

Get the latest binaries.

Usage

In order to use dmux you only need to define a map of your repositories and the branch to fetch from in a front matter on top of your Dockerfile.

---
git@github.com/owner/repository: master
---
FROM scratch
ADD repository .

You can add as many repositories as desired.

---
git@github.com/owner/repository-1: master
git@github.com/owner/repository-2: master
git@github.com/owner/repository-3: master
---
FROM scratch as repository-1
ADD repository-1 .
RUN build.sh
...
...

Authentication

If you plan on using ssh to fetch your repositories you’ll need to make sure your ssh-agent is properly initialized.

eval `ssh-agent` ssh-add

How does it work?

In order to build an image, Docker creates a context. A context is just a word for a tar archive of a given folder passed to the build command. That context is then sent to the Docker deamon in order to build the image.

dmux injects itself right before the context is created. It will create a context of its own made of all the files, folders and git repository passed in the front matter of the Dockerfile. After that, it mimics how Docker works.

Limits

Since the repository content is stored in memory before being passed to the docker context, it's a good idea to avoid repository with a lot of content.