Skip to content

Commit

Permalink
chore: remove run-in-docker logic from Makefile
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fnaranjo-vmw committed Feb 1, 2024
1 parent 08c9983 commit d94e2cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 0 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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\." )

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit d94e2cc

Please sign in to comment.