This commit is contained in:
aynic.os
2021-05-30 23:45:30 +02:00
parent 8a7a545a6c
commit c9821467de
12 changed files with 37 additions and 44 deletions
+5 -5
View File
@@ -13,7 +13,7 @@ build@%: myos-base
$(eval DRYRUN_IGNORE := false)
$(eval docker_images += $(foreach service,$(SERVICES),$(if $(shell docker images -q $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) 2>/dev/null),$(service))))
$(eval build_app := $(or $(filter $(DOCKER_BUILD_CACHE),false),$(filter-out $(docker_images),$(SERVICES))))
$(if $(build_app),$(call make,app-build),$(if $(filter $(VERBOSE),true),$(foreach service,$(SERVICES),echo "docker image $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) has id $(shell docker images -q $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) 2>/dev/null)" &&) true))
$(if $(build_app),$(call make,build-init app-build),$(if $(filter $(VERBOSE),true),$(foreach service,$(SERVICES),echo "docker image $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) has id $(shell docker images -q $(DOCKER_REPOSITORY)/$(service):$(DOCKER_IMAGE_TAG) 2>/dev/null)" &&) true))
# target build-env: Build .env file in docker $(SERVICE) to deploy
.PHONY: build-env
@@ -21,10 +21,10 @@ build-env: SERVICE ?= $(DOCKER_SERVICE)
build-env: bootstrap
$(call docker-compose-exec,$(SERVICE),rm -f .env && make .env ENV=$(ENV) && echo BUILD=true >> .env && echo BUILD_DATE='"\'"'$(shell date "+%d/%m/%Y %H:%M:%S %z" 2>/dev/null)'"\'"' >> .env && echo BUILD_STATUS='"\'"'$(shell git status -uno --porcelain 2>/dev/null)'"\'"' >> .env && echo DOCKER=false >> .env && $(foreach var,$(BUILD_APP_VARS),$(if $($(var)),sed -i '/^$(var)=/d' .env && echo $(var)='$($(var))' >> .env &&)) true)
# target build-rm: Empty build directory
.PHONY: build-rm
build-rm:
$(call exec,rm -rf build && mkdir -p build)
# target build-init: Empty build directory
.PHONY: build-init
build-init:
$(ECHO) rm -rf build && $(ECHO) mkdir -p build
# target build-$(SHARED): Create shared folder in docker $(SERVICE) to deploy
.PHONY: build-$(SHARED)
+1 -5
View File
@@ -2,13 +2,9 @@
# CLEAN
.PHONY: clean app-clean
clean: app-clean docker-compose-down clean-env ## Clean application and docker images
clean: app-clean docker-compose-down .env-clean ## Clean application and docker images
# target clean@%: Clean deployed application and docker images
.PHONY: clean@%
clean@%:
$(call make,docker-compose-down DOCKER_COMPOSE_DOWN_OPTIONS='--rmi all -v')
.PHONY: clean-env
clean-env:
rm -i .env || true
+4
View File
@@ -17,6 +17,10 @@ install-pgsql-database-%: myos-base
$(call exec,[ $$(PGPASSWORD=$* psql -h postgres -U $* -d $* -c "\d" 2>/dev/null |wc -l) -eq 0 ] && [ -f "${APP_DIR}/$*.pgsql.gz" ] && gzip -cd "${APP_DIR}/$*.pgsql.gz" |PGPASSWORD="postgres" psql -h postgres -U postgres -d $* || true)
$(call exec,[ $$(PGPASSWORD=$* psql -h postgres -U $* -d $* -c "\d" 2>/dev/null |wc -l) -eq 0 ] && [ -f "${APP_DIR}/$*.pgsql" ] && PGPASSWORD="postgres" psql -h postgres -U postgres -c "ALTER ROLE $* WITH SUPERUSER" && PGPASSWORD="postgres" pg_restore -h postgres --no-owner --role=$* -U postgres -d $* ${APP_DIR}/$*.pgsql && PGPASSWORD="postgres" psql -h postgres -U postgres -c "ALTER ROLE $* WITH NOSUPERUSER" || true)
.PHONY: install-build-parameters
install-build-parameters:
$(call install-parameters,,*,build)
.PHONY: install-parameters
install-parameters:
$(call install-parameters)
+1 -7
View File
@@ -3,20 +3,14 @@
## Clear symfony cache
.PHONY: cache-clear
cache-clear: cache-clear-dev cache-clear-prod
cache-clear: cache-clear-$(SYMFONY_ENV)
.PHONY: cache-clear-%
cache-clear-%: bootstrap ## Clear symfony cache
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console cache:clear --env=$*)
.PHONY: cache-rm
cache-rm: bootstrap
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -Rf app/cache/* app/logs/*)
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown www-data app/cache/ app/logs/))
.PHONY: cache-warmup
cache-warmup: cache-warmup-$(SYMFONY_ENV)
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown -R www-data app/cache/ app/logs/))
.PHONY: cache-warmup-%
cache-warmup-%: bootstrap
+2 -3
View File
@@ -1,12 +1,11 @@
##
# CLEAN
.PHONY: clean-php-app
clean-php-app: bootstrap
.PHONY: app-symfony-clean
app-symfony-clean: bootstrap
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/bootstrap.php.cache)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/cache/* app/cach~)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/logs/*)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf var/cache/* var/cach~)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf var/logs/*)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf vendor/*)
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf node_modules/*)
-1
View File
@@ -8,7 +8,6 @@ install-assets: install-assets-$(SYMFONY_ENV)
install-assets-%: bootstrap
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console assetic:dump --env=$*)
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console assets:install --env=$*)
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown -R www-data web/bundles/ web/css/ web/js/))
.PHONY: install-codecept
install-codecept: bootstrap install-phpunit vendor/codeception/codeception/codecept
-8
View File
@@ -25,14 +25,6 @@ test-coverage-codeception-%: bootstrap install-codecept ## Run codeception tests
test-func: bootstrap install-phpunit ## Run functional tests
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite functional)
## Loop unit tests
.PHONY: test-loop
test-loop: bootstrap install-phpunit ## Loop unit tests
while true; \
do $(MAKE) test; \
read continue; \
done;
## Run search tests
.PHONY: test-search
test-search: bootstrap install-phpunit ## Run search tests