Add a `make shell` rule to run a shell

master
Tim Hockin 2017-08-19 22:44:55 -07:00
parent 56748ed292
commit cf8254ea6f
1 changed files with 16 additions and 0 deletions

View File

@ -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