diff --git a/Makefile b/Makefile index d799a9c..c5aaeb0 100644 --- a/Makefile +++ b/Makefile @@ -98,6 +98,22 @@ bin/$(ARCH)/$(BIN): build-dirs ./build/build.sh \ " +# Example: make shell CMD="-c 'date > datefile'" +shell: build-dirs + @echo "launching a shell in the containerized build environment" + @docker run \ + -ti \ + --rm \ + -u $$(id -u):$$(id -g) \ + -v "$$(pwd)/.go:/go" \ + -v "$$(pwd):/go/src/$(PKG)" \ + -v "$$(pwd)/bin/$(ARCH):/go/bin" \ + -v "$$(pwd)/bin/$(ARCH):/go/bin/$$(go env GOOS)_$(ARCH)" \ + -v "$$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static" \ + -w /go/src/$(PKG) \ + $(BUILD_IMAGE) \ + /bin/sh $(CMD) + DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION)) container: .container-$(DOTFILE_IMAGE) container-name