diff --git a/.travis.yml b/.travis.yml index 8689556a..5a631ab7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,7 +38,7 @@ script: after_success: - docker image ls - - ${TRAVIS_BUILD_DIR}/scripts/docker-push.sh + - make release after_failure: - cd ${TRAVIS_BUILD_DIR}/${VERSION} && make logs diff --git a/7.1/Makefile b/7.1/Makefile index 4dccddaa..72d0ee68 100644 --- a/7.1/Makefile +++ b/7.1/Makefile @@ -2,30 +2,33 @@ -include env_make VERSION ?= 7.1 +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/7.1/config/php/zz-php.ini b/7.1/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.1/config/php/zz-php.ini +++ b/7.1/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/7.2/Makefile b/7.2/Makefile index 44cf6856..e127bccc 100644 --- a/7.2/Makefile +++ b/7.2/Makefile @@ -2,30 +2,33 @@ -include env_make VERSION ?= 7.2 +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/7.2/config/php/zz-php.ini b/7.2/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.2/config/php/zz-php.ini +++ b/7.2/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/7.3/Makefile b/7.3/Makefile index 913fb83b..0d425226 100644 --- a/7.3/Makefile +++ b/7.3/Makefile @@ -2,30 +2,33 @@ -include env_make VERSION ?= 7.3 +TAG_APPENDIX ?= -php$(VERSION) +BUILD_TAG = build-$(TAG_APPENDIX) REPO = docksal/cli -TAG = build-$(VERSION) NAME = docksal-cli-$(VERSION) CWD = $(shell pwd) # Improve write performance for /home/docker by turning it into a volume VOLUMES += -v /home/docker +.EXPORT_ALL_VARIABLES: + .PHONY: build test push shell run start stop logs clean release build: - docker build --cache-from=$(REPO):edge-php$(VERSION) -t $(REPO):$(TAG) . + docker build --cache-from=$(REPO):edge$(TAG_APPENDIX) -t $(REPO):$(BUILD_TAG) . test: - IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats + IMAGE=$(REPO):$(BUILD_TAG) NAME=$(NAME) VERSION=$(VERSION) ../tests/test.bats push: - docker push $(REPO):$(TAG) + docker push $(REPO):$(BUILD_TAG) run: clean - docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) start: clean - docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) + docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(BUILD_TAG) # Non-interactive and non-tty docker exec (uses LF instead of CRLF line endings) exec: @@ -50,7 +53,7 @@ logs-follow: clean: docker rm -vf $(NAME) >/dev/null 2>&1 || true -release: build - make push -e TAG=$(TAG) +release: + @../scripts/docker-push.sh default: build diff --git a/7.3/config/php/zz-php.ini b/7.3/config/php/zz-php.ini index 2ef39cd7..c653442d 100644 --- a/7.3/config/php/zz-php.ini +++ b/7.3/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use zz-php-fpm.conf [php] -memory_limit = 1024M +memory_limit = -1 max_execution_time = 600 date.timezone = UTC display_errors = On diff --git a/scripts/docker-push.sh b/scripts/docker-push.sh index c8724c9d..de955b29 100755 --- a/scripts/docker-push.sh +++ b/scripts/docker-push.sh @@ -40,27 +40,21 @@ tag_and_push () echo "Pushing ${target} image ..." docker tag ${source} ${target} docker push ${target} - - # Cloud9 flavor - echo "Pushing ${target}-ide image ..." - docker tag ${source}-ide ${target}-ide - docker push ${target}-ide } # ---------------------------- # -# Possible docker image tags -IMAGE_TAG_EDGE="edge-php${VERSION}" -IMAGE_TAG_STABLE="php${VERSION}" - -# Read the split parts +# Extract version parts from release tag IFS='.' read -a ver_arr <<< "$TRAVIS_TAG" +VERSION_MAJOR=${ver_arr[0]#v*} # 2.7.0 => "2" +VERSION_MINOR=${ver_arr[1]} # "2.7.0" => "7" -# Major version, e.g. 2-php7.2 -IMAGE_TAG_RELEASE_MAJOR="${ver_arr[0]#v*}-php${VERSION}" - -# Major-minor version, e.g. 2.5-php7.2 -IMAGE_TAG_RELEASE_MAJOR_MINOR="${ver_arr[0]#v*}.${ver_arr[1]}-php${VERSION}" +# Possible docker image tags +# "image:tag" pattern: :[-][-] +IMAGE_TAG_EDGE="edge${TAG_APPENDIX}" # e.g., edge[APPENDIX] +IMAGE_TAG_STABLE="stable${TAG_APPENDIX}" # e.g., stable[APPENDIX] +IMAGE_TAG_RELEASE_MAJOR="${VERSION_MAJOR}${TAG_APPENDIX}" # e.g., 2[APPENDIX] +IMAGE_TAG_RELEASE_MAJOR_MINOR="${VERSION_MAJOR}.${VERSION_MINOR}${TAG_APPENDIX}" # e.g., 2.7[APPENDIX] IMAGE_TAG_LATEST="latest" # Skip pull request builds @@ -70,14 +64,14 @@ docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}" # Push images if is_edge; then - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_EDGE} # Example tag: edge-php7.3 + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_EDGE} elif is_stable; then - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: php7.3 + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} elif is_release; then # Have stable, major, minor tags match - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_STABLE} # Example tag: php7.3 - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} # Example tag: 2-php7.3 - tag_and_push ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} # Example tag: 2.7-php7.3 + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_STABLE} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_RELEASE_MAJOR_MINOR} else # Exit if not on develop, master or release tag exit @@ -86,7 +80,5 @@ fi # Special case for the "latest" tag # Push (base image only) on stable and release builds if is_latest && (is_stable || is_release); then - echo "Pushing ${REPO}:${IMAGE_TAG_LATEST} image ..." - docker tag ${REPO}:build-${VERSION} ${REPO}:${IMAGE_TAG_LATEST} - docker push ${REPO}:${IMAGE_TAG_LATEST} + tag_and_push ${REPO}:${BUILD_TAG} ${REPO}:${IMAGE_TAG_LATEST} fi diff --git a/tests/test.bats b/tests/test.bats index e3f6e501..3c94731b 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -156,7 +156,9 @@ _healthcheck_wait () unset output output=$(echo "$phpInfo" | grep "memory_limit") - echo "$output" | grep "1024M => 1024M" + # grep expression cannot start with "-", so prepending the expression with "memory_limit" here. + # Another option is to do "grep -- '-...'". + echo "$output" | grep "memory_limit => -1 => -1" unset output output=$(echo "$phpInfo" | grep "sendmail_path")