external app

This commit is contained in:
Yann Autissier
2022-11-16 08:46:00 +00:00
parent 3d79bcdad3
commit 23cd8f2779
14 changed files with 135 additions and 275 deletions
+13 -10
View File
@@ -75,12 +75,13 @@ down: docker-compose-down ## Remove application dockers
# target exec: Exec ARGS in docker SERVICE
# on local host
.PHONY: exec
exec: SERVICE ?= $(DOCKER_SERVICE)
exec: ## Exec command in docker SERVICE
ifneq (,$(filter $(ENV),$(ENV_DEPLOY)))
$(RUN) $(call exec,$(ARGS))
else
$(call make,docker-compose-exec,,ARGS)
endif
#ifneq (,$(filter $(ENV),$(ENV_DEPLOY)))
# $(RUN) $(call exec,$(ARGS))
#else
$(call docker-compose-exec-sh,$(SERVICE),$(ARGS)) || true
#endif
# target exec@%: Exec ARGS in docker SERVICE of % ENV
# on all remote hosts
@@ -144,12 +145,14 @@ restart: docker-compose-restart app-start ## Restart application
# target run: Run command ARGS in a new docker SERVICE
# on local host
.PHONY: run
run: SERVICE ?= $(DOCKER_SERVICE)
run: ## Run a command in a new docker
ifneq (,$(filter $(ENV),$(ENV_DEPLOY)))
$(call run,$(ARGS))
else
$(call make,docker-compose-run,,ARGS)
endif
#ifneq (,$(filter $(ENV),$(ENV_DEPLOY)))
# $(call run,$(ARGS))
#else
$(eval DOCKER_RUN_OPTIONS += -it)
$(call docker-compose,run $(DOCKER_COMPOSE_RUN_OPTIONS) $(SERVICE) $(ARGS))
#endif
# target run@%: Run command ARGS in a new docker SERVICE of % ENV
# on all remote hosts
+1 -1
View File
@@ -61,7 +61,7 @@ endif
# function docker-build: Build docker image
define docker-build
$(call INFO,docker-build,$(1)$(comma) $(2)$(comma) $(3))
$(eval path := $(patsubst %/,%,$(1)))
$(eval path := $(patsubst $(DOCKER_BUILD_DIR)/%,%,$(patsubst %/,%,$(1))))
$(eval service := $(subst .,,$(call LOWERCASE,$(lastword $(subst /, ,$(path))))))
$(eval tag := $(or $(2),$(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG)))
$(eval target := $(subst ",,$(subst ',,$(or $(3),$(DOCKER_BUILD_TARGET)))))
+2 -1
View File
@@ -1,5 +1,5 @@
APP_DIR ?= $(CURDIR)
APP_DOMAIN ?= $(addsuffix .,$(filter-out master,$(ENV)))$(USER).$(DOMAIN)
APP_DOMAIN ?= $(addsuffix .,$(filter-out $(ENV_DEPLOY),$(ENV)))$(USER).$(DOMAIN)
APP_HOST ?= $(addsuffix .,$(APP_NAME))$(APP_DOMAIN)
APP_INSTALLED ?= $(APPS)
APP_PARENT ?= $(MONOREPO)
@@ -16,6 +16,7 @@ APP_SCHEME ?= https
APP_UPSTREAM_REPOSITORY ?= $(or $(shell git config --get remote.upstream.url 2>/dev/null),$(GIT_UPSTREAM_REPOSITORY))
APP_URI ?= $(APP_HOST)/$(APP_PATH)
APP_URL ?= $(APP_SCHEME)://$(APP_URI)
CMDARGS += exec exec:% exec@% run run:% run@%
CONTEXT += APP APPS BRANCH DOMAIN VERSION RELEASE
CONTEXT_DEBUG += APP_DIR APP_URL APP_REPOSITORY APP_UPSTREAM_REPOSITORY ENV_DEPLOY
ENV_DEPLOY ?= $(shell ls .git/refs/remotes/origin/ 2>/dev/null)