Skip to content

Commit

Permalink
Update Makefile targets related to RabbitMQ (#163)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Zerpet authored Feb 1, 2023
1 parent 2a72f68 commit cce7a15
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit cce7a15

Please sign in to comment.