diff --git a/do.sh b/do.sh index e59da1b..5043e2b 100755 --- a/do.sh +++ b/do.sh @@ -1,7 +1,7 @@ #!/bin/bash usage() { - echo "Usage $0 (build-linux|docker-image|docker-build|test-sync|sync)" + echo "Usage $0 (build-linux|docker-image|docker-dep|docker-build|test-sync|sync)" } if [ "$1" == "" ]; then @@ -19,8 +19,11 @@ while (( "$#" )); do docker-image) docker build -t space-devices-build docker/ ;; + docker-dep) + docker run --rm -it -v $(pwd):/go/src/github.com/ktt-ol/spaceDevices -u $(id -u):$(id -g) space-devices-build dep ensure -v -vendor-only + ;; docker-build) - docker run --rm -it -v $(pwd):/go/src/spaceDevices space-devices-build dep ensure -v -vendor-only && ./do.sh build-linux + docker run --rm -it -v $(pwd):/go/src/github.com/ktt-ol/spaceDevices -u $(id -u):$(id -g) space-devices-build ./do.sh build-linux ;; test-sync) rsync -n -avzi --delete spaceDevices listUnkown webUI macVendorDb.csv root@spacegate:/home/status/spaceDevices2/ diff --git a/docker/Dockerfile b/docker/Dockerfile index 828961e..7276e80 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,7 @@ FROM golang:1.13 RUN curl -fsSL -o /usr/local/bin/dep https://github.com/golang/dep/releases/download/0.5.2/dep-linux-amd64 && chmod +x /usr/local/bin/dep +RUN mkdir -p /go/src/github.com/ktt-ol/spaceDevices -RUN mkdir -p /go/src/spaceDevices -WORKDIR /go/src/spaceDevices +ENV HOME=/tmp +WORKDIR /go/src/github.com/ktt-ol/spaceDevices diff --git a/docker/README.md b/docker/README.md index d62449f..980b649 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,5 +11,9 @@ Use the `do.sh` script file in the top directory. ## Build binary ```shell script +# installs dependencies, only once needed +./do.sh docker-dep + +# build the binary ./do.sh docker-build ```