Skip to content

Commit

Permalink
Mount go's build cache in make shell
Browse files Browse the repository at this point in the history
  • Loading branch information
tdmanv committed Aug 15, 2019
1 parent acb778a commit 7d94480
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,19 @@ bin/$(ARCH)/$(BIN):
# Example: make shell CMD="-c 'date > datefile'"
shell: build-dirs
@echo "launching a shell in the containerized build environment"
@docker run \
-ti \
--rm \
--privileged \
--net host \
-v "$(PWD)/.go/pkg:/go/pkg" \
-v "$(PWD):/go/src/$(PKG)" \
-v "$(PWD)/bin/$(ARCH):/go/bin" \
-v "$(PWD)/bin/$(ARCH):/go/bin/$$(go env GOOS)_$(ARCH)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
@docker run \
-ti \
--rm \
--privileged \
--net host \
-v "$(PWD)/.go/pkg:/go/pkg" \
-v "$(PWD)/.go/cache:/go/.cache" \
-v "$(PWD):/go/src/$(PKG)" \
-v "$(PWD)/bin/$(ARCH):/go/bin" \
-v "$(PWD)/bin/$(ARCH):/go/bin/$$(go env GOOS)_$(ARCH)" \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/$(PKG) \
$(BUILD_IMAGE) \
/bin/sh

DOTFILE_IMAGE = $(subst :,_,$(subst /,_,$(IMAGE))-$(VERSION))
Expand Down

0 comments on commit 7d94480

Please sign in to comment.