From d94e2cc4c23106947f3dd125ab7175bb2bf242dd Mon Sep 17 00:00:00 2001 From: Fernando Naranjo Date: Thu, 1 Feb 2024 01:34:59 +0100 Subject: [PATCH] chore: remove run-in-docker logic from Makefile The same benefits can be achieved by simply launching an interactive docker session inside a supported image and running commands from there. This approach has some additional benefits - Easier to maintain - Debloats Makefile - Less hidden magic - Same code for local and containerised execution --- Makefile | 7 ------- README.md | 8 +++++++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index e4cccb5ef..525a7d3bb 100644 --- a/Makefile +++ b/Makefile @@ -11,15 +11,8 @@ else OSFAMILY=linux endif -ifeq ($(USE_GO_CONTAINERS),) GO=go GOFMT=gofmt -else -UID:=$(shell id -u) -DOCKER_OPTS=--rm -u $(UID) -v $(HOME):$(HOME) -e HOME -e USER=$(USER) -e USERNAME=$(USER) -w $(PWD) -GO=docker run $(DOCKER_OPTS) -e GOARCH -e GOOS -e CGO_ENABLED golang:$(GO-VERSION) go -GOFMT=docker run $(DOCKER_OPTS) -e GOARCH -e GOOS -e CGO_ENABLED golang:$(GO-VERSION) gofmt -endif SRC = $(shell find . -name "*.go" | grep -v "_test\." ) diff --git a/README.md b/README.md index bb975f483..0ad456989 100755 --- a/README.md +++ b/README.md @@ -64,7 +64,13 @@ It supports the following sub-commands: ## Development `make` is used to orchestrate most development tasks. -`go` is required to build the broker. If you don't have `go` installed, it is possible to use a `docker` image to build and unit test the broker. If the environment variable `USE_GO_CONTAINERS` exists, `make` will use `docker` versions of the tools so you don't need to have them installed locally. +`go` is required to build the broker. +If you don't have `go` installed, it is possible to use `docker` to launch an interactive shell into some supported image containing all necessary tools. For example: +``` +# From the root of this repo run: +docker run -it --rm -v "${PWD}:/repo" --workdir "/repo" --entrypoint "/bin/bash" cflondonservices/csb-ci-main +make +``` There are make targets for most common dev tasks. Running make without a target will list the possible targets.