Closed jamezpolley closed 5 years ago
@jamezpolley Weird! There's a "deps" target in the Makefile, isn't there?
Yeah. I think the CWD is wrong though.
@jamezpolley why is herokuish
under a morph-ng directory? It's not checked out inside another repo is it?
no, not inside another repo :)
workdir seems to be correct.. continuing to explore
https://kubernetes.io/docs/setup/learning-environment/minikube/#mounted-host-folders
On linux, using the Virtualbox driver, /home
is mounted at /hosthome
so $PWD isn't useful.
We could do something to detect the right path to use based on the host OS ($PWD for macOS; something under /c/Users for Windows; s/home/hosthome/
for linux).
Maybe it's easier to use minikube mount ${PWD}:/src/github.com/gliderlabs/herokuish
so that the Makefile can always look in a consistent location? Downside is that the minikube mount
process needs to stay running..
I don't understand your comment at all. I don't know where $PWD is being referenced and I don't understand why the location of home is being used at all and I don't understand why minikube has anything to do with this.
https://github.com/mlandauer/herokuish/blob/4778a23a76f94444523af5c63740a3540ecc593c/Makefile#L39
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \
-v /var/lib/docker:/var/lib/docker \
-v ${PWD}:/src/github.com/gliderlabs/herokuish -w /src/github.com/gliderlabs/herokuish \
-e IMAGE_NAME=$(IMAGE_NAME) -e BUILD_TAG=$(BUILD_TAG) -e VERSION=master \
$(NAME)-build make -e deps build
If this was pointing at my local docker daemon, -v ${PWD}:/src/github.com/gliderlabs/herokuish
would mount $PWD into the docker container as it runs.
But I've used eval $(minikube docker-env)
so docker is talking to the dockerd inside the VirtualBox VM that minikube created.
On Mac, /Users
on the host is mounted as /Users
inside the minikube VM, so this still works, because when make
on the host runs $PWD
it expands to a path that the dockerd inside the minikube VM can read.
On Linux, /home
on the host is mounted to /hosthome
on the VM. -v /hosthome/james/src/oaf/morph-ng/herokuish:/src/github.com/gliderlabs/herokuish
would work, but -v /home/james/src/oaf/morph-ng/herokuish:/src/github.com/gliderlabs/herokuish
doesn't.
Ah gotcha. Thanks for the explanation! Well that's a pain isn't it. Would this be solved by converting the "build-in-docker" to a multi-stage build Dockerfile instead?
I don't think so - you'd still need to map to the correct path inside the minikube vm, and that varies for different OS/driver combinations.
I think I can work around it with something like minikube start --mount --mount-string $HOME:$HOME
. Testing that now.
Yep, that works; see #8
Second run output: