From cce7a1556ae321b91783bf0f02fff04e1c045ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aitor=20P=C3=A9rez=20Cedres?= <1515757+Zerpet@users.noreply.github.com> Date: Wed, 1 Feb 2023 15:45:06 +0000 Subject: [PATCH] Update Makefile targets related to RabbitMQ (#163) Simplified version of 'stop-rabbitmq-server'. There is no need to figure out the container ID, because `docker stop` supports container names. Container name can now be customised. Signed-off-by: Aitor Perez Cedres --- Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4e8661e..47e882f 100644 --- a/Makefile +++ b/Makefile @@ -23,12 +23,14 @@ tests: ## Run all tests and requires a running rabbitmq-server check: golangci-lint run ./... +CONTAINER_NAME ?= amqp091-go-rabbitmq + .PHONY: rabbitmq-server -rabbitmq-server: - docker run --detach --rm --name amqp091-go-rabbitmq \ +rabbitmq-server: ## Start a RabbitMQ server using Docker. Container name can be customised with CONTAINER_NAME=some-rabbit + docker run --detach --rm --name $(CONTAINER_NAME) \ --publish 5672:5672 --publish 15672:15672 \ --pull always rabbitmq:3-management .PHONY: stop-rabbitmq-server -stop-rabbitmq-server: - docker stop $$(docker inspect --format='{{.Id}}' amqp091-go-rabbitmq) +stop-rabbitmq-server: ## Stop a RabbitMQ server using Docker. Container name can be customised with CONTAINER_NAME=some-rabbit + docker stop $(CONTAINER_NAME)