A Go project can not run with GVM and a watcher in a Docker container (GOPATH can not be set correctly)

There were problems trying to run a Docker image that creates a Go project.

Any help would be very grateful, since I've been stuck to it for days. I'm not an expert on Docker, so I could make a rookie mistake.

I am trying to release a volume on my computer for my Go project, then installing Go 1.9 in the Docker container and using GVM, so I can easily change its version later. I also use this Watcher: / canthefason / go-watcher to automatically rebuild the Go project whenever I change a file.

But if I Put Docker together In my container, the observer can not create the project, he tells me Package can not be loaded: Paketfinanzierung: no Go files in / go / src / finance,

The root folder of the project on my computer (/ Finance) does not contain a Go file (the Go files are located in subfolders of this root folder), so the project structure looks like this:

    - finance
- to build
- package
- dockerfile
- entrypoint.sh
- cmd
- finance
- main.go
- internally
- other .go files
- docker-compose.yml

In my Dockerfile I explain one


It does not work to use it as my GOPATH.
I tried too RUN export GOPATH = / go right in front of the last lines of the Dockerfile, but it does not work either.

When my container is running, the GOPATH is always on GOPATH = "/ root / .gvm / pkgsets / go1.9 / global" I found out that this is due to GVM, but I do not want the GOPATH standard to be changed GOPATH = / go and I suspect that the observer can not create the Go project because of this discrepancy.

Basically, I can not set my GOPATH because GVM has always set it for its default path. This is probably why Watcher can not compile and run my Go project.

Here is my Dockerfile:

                FROM buildpack-deps: jessie-scm
MAINTAINER Can Yucel "can.yucel@gmail.com"

Run apt-get update && pt-get install -y --no-install-recommends 
g ++
&& rm -rf / var / lib / apt / list / *

BOWL ["/bin/bash", "-c"]


RUN curl -s -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer | bash

RUN. /root/.gvm/scripts/gvm&& 
gvm install go $ {GO_VERSION} -B && 
gvm use go $ {GO_VERSION}


ADD https://github.com/canthefason/go-watcher/releases/download/v${WATCHER_VERSION}/watcher-${WATCHER_VERSION}-linux-amd64/root/.gvm/bin/watcher

RUN chmod + x /root/.gvm/bin/watcher.

# Apparently that's useless  /

WORKDIR / go / src / finance

ADD ./build/package/entrypoint.sh / go / src / finance / cmd / finance

RUN chmod + x / go / src / finance / cmd / finance.

# That does not seem to work !!  /
RUN export GOPATH = $ {GOPATH}

ENTRY POINT ["/entrypoint.sh"]
    CMD ["watcher"]