Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Makefile - getting ready for docker compose V2 #2163

Open
wants to merge 2 commits into
base: 6.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

SOURCE = "./lib"
TARGET?=70
DOCKER_COMPOSE_CMD := $(shell if [ ! -z "`docker compose version`" ]; then echo "docker compose"; else echo "docker-compose"; fi 2>/dev/null)

# By default docker environment is used to run commands. To run without the predefined environment, set RUN_ENV=" " either as parameter or as environment variable
ifndef RUN_ENV
Expand All @@ -11,7 +12,7 @@ endif

.PHONY: clean
clean:
docker-compose down -v
${DOCKER_COMPOSE_CMD} down -v
rm -r -f ./build
rm -r -f ./vendor
rm -r -f ./composer.lock
Expand Down Expand Up @@ -71,7 +72,7 @@ test:
make elastica-image
make start
mkdir -p build
docker-compose run -e "ES_HOST=elasticsearch" elastica phpunit -c test/ ${TEST}
${DOCKER_COMPOSE_CMD} run -e "ES_HOST=elasticsearch" elastica phpunit -c test/ ${TEST}

.PHONY: doc
doc:
Expand Down Expand Up @@ -100,20 +101,20 @@ phploc:
# VIRTUAL ENVIRONMENT
.PHONY: build
build:
docker-compose build
${DOCKER_COMPOSE_CMD} build

.PHONY: start
start:
docker-compose up -d --build
${DOCKER_COMPOSE_CMD} up -d --build

.PHONY: stop
stop:
docker-compose stop
${DOCKER_COMPOSE_CMD} stop

.PHONY: destroy
destroy: clean
docker-compose kill
docker-compose rm
${DOCKER_COMPOSE_CMD} kill
${DOCKER_COMPOSE_CMD} rm

# Stops and removes all containers and removes all images
.PHONY: destroy-environment
Expand All @@ -134,7 +135,7 @@ shell:
# Starts a shell inside the elastica image with the full environment running
.PHONY: env-shell
env-shell:
docker-compose run elastica /bin/bash
${DOCKER_COMPOSE_CMD} run elastica /bin/bash

# Visualise repo
.PHONY: gource
Expand Down