doma
is a Makefile template collextion around your docker and application build process.
IMPORTANT NOTICE! THIS PROJECT IS IN ALPHA STAGE.
make
docker
>= 1.6.0
doma provides a base Makefile
for the basic command around your Docker stack.
It can distinguish sub-stacks by prefixes and handles naming of images and containers through
environment variables to keep a clean Docker build environment and minimal overhead when building
and push images and running containers.
- stack templating
- stack environments
- stack build management
- stack deployment
Get doma by cloning the repository into a location of your choice
git clone [email protected]:t.munk/doma.git
Link the script to a directory from PATH
and set permissions
echo -e "export DOMA_DIR=`pwd`/doma" >> ~/.bash_profile
You can also put doma Makefile
s into your project folder, or include them as a submodule.
Examples based on phundament/4.0
template
Show help
make
usually you should be able to get started with
make all
build your images
make app-build
you can also chain commands
make docker-destroy docker-up app-setup app-open
or use a configuration target, written in uppercase by convention (TEST
), to select another stack via ENV variables
make TEST app-run-tests
you can run also combine these to compile assets and build images with their default names and then start the STAGING
stack configuration with images from the first build process
make app-build-assets app-build-all STAGING all
Go to a project with a docker-compose
file located in the root folder and create a Makefile
.
# Project Settings
# ----------------
COMPOSE_PROJECT_NAME ?= elk
# Templates
# ---------
include $(DOMA_DIR)/docker/Makefile
Adjust the Makefile
file in your project with your basic project settings...
# Settings
# --------
COMPOSE_PROJECT_NAME ?= myapp
COMPOSE_FILE ?= docker-compose.yml
REGISTRY_HOST ?= registry.hrzg.de
REGISTRY_USER ?= registry
PROJECT_REGISTRY ?= registry.hrzg.de/tci-partners
APP_NAMES ?= app
APP_FOLDERS ?= .
BUILDER_SERVICE_SUFFIX ?= builder
TEST_VERBOSITY ?=-v
default: help
...and include the desired templates.
# Templates
# ---------
include $(DOMA_DIR)/phundament/4.0/Makefile
Finally add your configuration targets.
# Local development config targets
# --------------------------------
TEST: ##@app configure application for local testing
$(eval BUILDER_SERVICE_SUFFIX := builder)
$(eval COMPOSE_FILE := docker-compose-test-local.yml)
$(eval COMPOSE_PROJECT_NAME := testmyapp)
STAGING: ##@app configure application for local staging
$(eval BUILDER_SERVICE_SUFFIX := builder)
$(eval COMPOSE_FILE := docker-compose-test-local.yml)
$(eval COMPOSE_PROJECT_NAME := testmyapp)
To forward targets to sub-stack you can use the following targets:
.EXPORT_ALL_VARIABLES:
.DEFAULT:
@for folder in $(APP_FOLDERS); do \
$(MAKE) -C $$folder COMPOSE_FILE=../$(COMPOSE_FILE) $@ ; \
done
To ensure a consistent naming in the development and deployment process, set the following values
PROJECT_REGISTRY=registry/username
COMPOSE_PROJECT_NAME=yii2project
You can add multiple apps by using a prefix, make sure that both lists correspond exactly!
APP_NAMES = app api
APP_FOLDERS = ./app ./api
BUILDER_SERVICE_SUFFIX = src
WEB_SERVICE_SUFFIX = web
REGISTRY_HOST=tutum.co
REGISTRY_USER=username
REGISTRY_PASS=secret
One-liner to install doma e.g. on your CI system
# instant-doma (Makefile templates)
if [ -d doma ] ; then git -C doma pull ; else git clone https://github.com/schmunk42/doma.git doma ; fi ; export DOMA_DIR=`pwd`/doma
PRs are always highly welcome.
- Tobias Munk (schmunk42)
- Tim Gleue
- GitHub
- docker-stack - docker-compose stack templates
- Phundament
- diemeisterei