Initial template
This commit is contained in:
commit
9f2788e4cf
9 files changed
+138
No files matched your search
@@ -0,0 +1,47 @@
|
||||
COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose
|
||||
IMAGE := {{ project_slug }}/{{ part }}
|
||||
changed = ! git diff --quiet $(1) -- $(2) 2>/dev/null
|
||||
stamp = { git update-ref $(1) HEAD 2>/dev/null || true; }
|
||||
|
||||
.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down deploy {% endif %}fmt check build pre-deploy post-deploy
|
||||
|
||||
fmt:
|
||||
@:
|
||||
|
||||
check:
|
||||
@:
|
||||
|
||||
build:
|
||||
$(COMPOSE) build {{ service }}
|
||||
|
||||
pre-deploy:
|
||||
@if $(call changed,refs/deploy/{{ part }},.) || ! docker image inspect $(IMAGE) >/dev/null 2>&1; then \
|
||||
$(MAKE) build && $(call stamp,refs/deploy/{{ part }}); \
|
||||
fi
|
||||
|
||||
post-deploy:
|
||||
@:
|
||||
{% if layout == 'root' %}
|
||||
env:
|
||||
@test -f .env || cp .env.example .env
|
||||
@test -f docker-compose.override.yml || cp docker-compose.override.yml.example docker-compose.override.yml
|
||||
|
||||
recreate:
|
||||
$(COMPOSE) up -d --force-recreate
|
||||
|
||||
rebuild: build
|
||||
$(COMPOSE) up -d
|
||||
|
||||
restart:
|
||||
$(COMPOSE) restart
|
||||
|
||||
logs:
|
||||
$(COMPOSE) logs -f --tail=100
|
||||
|
||||
down:
|
||||
$(COMPOSE) down
|
||||
|
||||
deploy: pre-deploy
|
||||
$(COMPOSE) up -d
|
||||
$(MAKE) post-deploy
|
||||
{% endif %}
|
||||
Reference in new issue
Block a user