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

Improve rules in Makefile (simplify, fix message, support podman) #30

Open
wants to merge 3 commits into
base: update-ocrd_all
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
31 changes: 21 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,36 +1,47 @@
ifeq ($(shell type podman-compose >/dev/null 2>&1 && echo y),)
# Use docker / docker compose
DOCKER_COMPOSE=docker compose
DOCKER=docker
else
# Use podman / podman-compose
DOCKER_COMPOSE=podman-compose
DOCKER=podman
endif

.PHONY: build clean clean-results clean-workspaces prepare-default-gt run start stop

build:
docker compose build
$(DOCKER_COMPOSE) build

start:
docker compose up -d
docker compose run -d ocr
$(DOCKER_COMPOSE) up -d
$(DOCKER_COMPOSE) run -d ocr

prepare-default-gt:
docker compose exec ocr bash scripts/prepare.sh
$(DOCKER_COMPOSE) exec ocr bash scripts/prepare.sh
python3 helpers/post_gt_to_mongodb.py

run:
mkdir -p logs
docker compose exec ocr bash scripts/run_trigger.sh
$(DOCKER_COMPOSE) exec ocr bash scripts/run_trigger.sh

reinstall:
docker compose exec ocr pip install -e .
$(DOCKER_COMPOSE) exec ocr pip install -e .

restart:
make stop
make build
make start

stop:
CONTAINER_ID=$$(docker ps | grep quiver | cut -d' ' -f1); docker container stop $$CONTAINER_ID && docker container rm $$CONTAINER_ID
CONTAINER_ID=$$($(DOCKER) ps | grep quiver | cut -d' ' -f1); test -n "$$CONTAINER_ID" && $(DOCKER) container stop $$CONTAINER_ID || true
CONTAINER_ID=$$($(DOCKER) ps -a | grep quiver | cut -d' ' -f1); test -n "$$CONTAINER_ID" && $(DOCKER) container rm $$CONTAINER_ID || true

clean-workspaces:
docker compose exec ocr rm -rf workflows/workspaces
rm -rf workflows/workspaces

clean-results:
docker compose exec ocr rm -rf workflows/nf-results workflows/results
rm -rf workflows/nf-results workflows/results

clean: clean-workspaces clean-results
@echo "Cleaning everything."
@echo "Cleaned everything."