diff --git a/.drone.yml b/.drone.yml index e48c6c0..7da4491 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,14 +20,11 @@ steps: environment: GO111MODULE: on RETHINKDB_URI: "database:28015" - COVERALLS_TOKEN: - from_secret: coveralls-token commands: - go build . - sleep 10 # let the DB test instance come up first - make test - make checks - - make upload-coverage when: event: - pull_request @@ -67,7 +64,7 @@ steps: repo: oliver006/rethinkdb_exporter target: scratch build_args: - - 'TAG=${DRONE_TAG}' + - 'TAG=tst' - 'SHA1=${DRONE_COMMIT_SHA}' - 'GOARCH=amd64' username: @@ -77,4 +74,20 @@ steps: when: event: - tag - \ No newline at end of file + +# got to do this last cause it'll mess up the go.mod / go.sum file and that breaks the docker build + - name: upload-coverage + image: "golang:1.16" + environment: + GO111MODULE: on + RETHINKDB_URI: "database:28015" + COVERALLS_TOKEN: + from_secret: coveralls-token + commands: + - ls -la + - make upload-coverage + when: + event: + - pull_request + - push + - tag diff --git a/Dockerfile b/Dockerfile index 3aea308..767a631 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,16 @@ FROM golang:1.16-alpine as builder WORKDIR /go/src/github.com/oliver006/rethinkdb_exporter/ -ADD . /go/src/github.com/oliver006/rethinkdb_exporter/ +ADD . /go/src/github.com/oliver006/rethinkdb_exporter/ ARG GOARCH="amd64" ARG SHA1="[no-sha]" ARG TAG="[no-tag]" +RUN ls -la +RUN cat go.mod +RUN cat go.sum + RUN apk --no-cache add ca-certificates RUN BUILD_DATE=$(date +%F-%T) && CGO_ENABLED=0 GOOS=linux GOARCH=$GOARCH go build -o /bin/rethinkdb_exporter \ -ldflags "-s -w -extldflags \"-static\" -X main.BuildVersion=$TAG -X main.BuildCommitSha=$SHA1 -X main.BuildDate=$BUILD_DATE" .