diff --git a/Dockerfile b/Dockerfile index 34f2fb7..a1409dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # STEP 1 build executable file ############################## FROM golang:alpine AS builder -RUN apk update && apk add --no-cache git gcc libc-dev openssl +RUN apk update && apk add --no-cache git gcc libc-dev openssl && go install github.com/gobuffalo/packr/packr@latest WORKDIR /go/src/securitybunker/databunker/src/ COPY src/go.mod ./deps RUN cat ./deps | grep -v storage > ./go.mod && go mod download diff --git a/build.sh b/build.sh index abf2445..796deb7 100755 --- a/build.sh +++ b/build.sh @@ -7,7 +7,29 @@ HASH=$(git rev-parse --short=12 HEAD) TIMESTAMP=$(date +%Y%m%d%H%M%S) # Current timestamp FULL_VERSION=$VERSION-$TIMESTAMP-$HASH +if [ -x "~/go/bin/packr" ]; then + echo "Found ~/go/bin/packr" +elif [ -x "packr" ]; then + echo "Fond packr" +else + go install github.com/gobuffalo/packr/packr@latest +fi + cd src go get -d -v + +if [ -x "~/go/bin/packr" ]; then + ~/go/bin/packr +elif [ -x "packr" ]; then + packr +fi + go build -v -ldflags="-s -w -X main.version=$FULL_VERSION" -o ../databunker + +if [ -x "~/go/bin/packr" ]; then + ~/go/bin/packr clean +elif [ -x "packr" ]; then + packr clean +fi + cd ..