Add a `make shell` rule to run a shell
parent
56748ed292
commit
cf8254ea6f
16
Makefile
16
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
|
||||
|
|
Loading…
Reference in New Issue