From 7e1de54a63f0a94000c449ae304a650967903abd Mon Sep 17 00:00:00 2001 From: iberdinsky-skilld Date: Wed, 7 Aug 2019 12:11:26 +0600 Subject: [PATCH] merged make all by param, disabled clean. --- .env.default | 1 + .gitlab-ci.yml | 2 +- Makefile | 3 +++ scripts/makefile/front.mk | 25 +++++++++---------------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/.env.default b/.env.default index aabea5b97..246eb2b45 100644 --- a/.env.default +++ b/.env.default @@ -12,6 +12,7 @@ PROJECT_INSTALL= IMAGE_PHP=skilldlabs/php:73-fpm IMAGE_NGINX=skilldlabs/nginx:1.16 IMAGE_FRONT=node:lts-alpine +CLEAR_FRONT_PACKAGES=no IMAGE_DRIVER=zenika/alpine-chrome ADD_PHP_EXT= MAIN_DOMAIN_NAME=docker.localhost diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d867d7c98..2fe5945a1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,7 +139,7 @@ deploy:review: - echo "INSTALL_DEV_DEPENDENCIES=TRUE" >> .env.default - docker --version - docker-compose --version - - make all_ci + - make all MAKE_ENV=ci after_script: - echo "Started ${CI_ENVIRONMENT_URL} composition in ${BUILD_DIR} from Makefile." environment: diff --git a/Makefile b/Makefile index fc757cec5..b27bb0c55 100644 --- a/Makefile +++ b/Makefile @@ -127,6 +127,9 @@ endif make -s down @for i in $(DIRS); do if [ -d "$$i" ]; then echo "Removing $$i..."; docker run --rm -v $(shell pwd):/mnt $(IMAGE_PHP) sh -c "rm -rf /mnt/$$i"; fi; done if [ -d $(DB_DATA_DIR) ]; then echo "Removing mysql data $(DB_DATA_DIR) ..."; docker run --rm --user 0:0 -v $(shell pwd):/mnt/2rm $(IMAGE_PHP) sh -c "rm -rf /mnt/2rm/$(DB_DATA_DIR)"; fi +ifeq ($(CLEAR_FRONT_PACKAGES), yes) + make clear-front +endif ## Enable development mode and disable caching dev: diff --git a/scripts/makefile/front.mk b/scripts/makefile/front.mk index 6cb6259b7..75e38ef29 100644 --- a/scripts/makefile/front.mk +++ b/scripts/makefile/front.mk @@ -1,11 +1,7 @@ -# Evaluate recursively. -CUID ?= $(LOCAL_UID) -CGID ?= $(LOCAL_GID) -CLEAR_FRONT_PACKAGES?=yes FRONT_PORT?=65200 # Execute front container function. -front = docker run \ +frontexec = docker run \ --rm \ --init \ -p $(FRONT_PORT):$(FRONT_PORT) \ @@ -15,26 +11,23 @@ front = docker run \ $(IMAGE_FRONT) ${1} clear-front: -ifeq ($(CLEAR_FRONT_PACKAGES), yes) - @echo "Clean of node_modules... To skip this action please set CLEAR_FRONT_PACKAGES=no in .env file" - $(call front, rm -rf /app/node_modules) -endif + @echo "Clean of node_modules and compiled dist... To skip this action please set CLEAR_FRONT_PACKAGES=no in .env file" + $(call frontexec, rm -rf /app/node_modules /app/dist) front: @echo "Running front tasks..." docker pull $(IMAGE_FRONT) - $(call front, yarn install --prod --ignore-optional --check-files) - $(call front, yarn build --verbose) - make clear-front + $(call frontexec, yarn install --prod --ignore-optional --check-files) + $(call frontexec, yarn build --verbose) lint: @echo "Running theme linters with fix..." docker pull $(IMAGE_FRONT) - $(call front, yarn install --prod --ignore-optional --check-files) - $(call front, yarn lint-fix) + $(call frontexec, yarn install --prod --ignore-optional --check-files) + $(call frontexec, yarn lint-fix) storybook: @echo "Running storybook..." docker pull $(IMAGE_FRONT) - $(call front, yarn install --ignore-optional --check-files) - $(call front, yarn storybook -p $(FRONT_PORT)) + $(call frontexec, yarn install --ignore-optional --check-files) + $(call frontexec, yarn storybook -p $(FRONT_PORT))