Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver006 committed Mar 19, 2021
1 parent ce49dbb commit a284b3f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
23 changes: 18 additions & 5 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -77,4 +74,20 @@ steps:
when:
event:
- tag


# 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
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" .
Expand Down

0 comments on commit a284b3f

Please sign in to comment.