File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 38
38
services : [docker]
39
39
40
40
before_deploy :
41
- - make packages
42
- - echo "${TRAVIS_TAG}" > version.txt
41
+ - make static-package
43
42
- make docker-push-latest-release
44
43
45
44
deploy :
Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ FROM golang:1.11-alpine as builder
6
6
ENV GITBASE_REPO=github.com/src-d/gitbase
7
7
ENV GITBASE_PATH=$GOPATH/src/$GITBASE_REPO
8
8
9
- RUN apk add --no-cache git
9
+ RUN apk add --update -- no-cache libxml2-dev git make bash gcc g++ curl oniguruma-dev oniguruma
10
10
11
11
COPY . $GITBASE_PATH
12
12
WORKDIR $GITBASE_PATH
13
- RUN go build -ldflags="-X main.version=$(cat version.txt || echo " undefined") -X main.build=$(date +" %m-%d-%Y_%H_%M_%S") -X main.commit=$(git rev-parse --short HEAD) -s -w" -o /bin/gitbase ./cmd/gitbase
13
+
14
+ ENV GO_BUILD_ARGS="-o /bin/gitbase"
15
+ ENV GO_BUILD_PATH="./cmd/gitbase"
16
+ RUN make static-build
14
17
15
18
# =================================
16
19
# Stage 2: Start Gitbase Server
Original file line number Diff line number Diff line change @@ -30,11 +30,12 @@ static-package:
30
30
docker rm gitbase-temp
31
31
32
32
# target used in the Dockerfile to build the static binary
33
- static-build : VERSION = $(shell git describe --exact-match --tags 2>/dev/null || dev-$(git rev-parse --short HEAD )$(test -n "`git status --porcelain`" && echo "-dirty" || true ) )
34
- static-build : LD_FLAGS += -linkmode external -extldflags '-static -lz'
33
+ static-build : VERSION ? = $(shell git describe --exact-match --tags 2>/dev/null || " dev-$(git rev-parse --short HEAD )$(test -n "`git status --porcelain`" && echo "-dirty" || true ) " )
34
+ static-build : LD_FLAGS += -linkmode external -extldflags '-static -lz' -s -w
35
35
static-build : GO_BUILD_ARGS += -tags oniguruma
36
+ static-build : GO_BUILD_PATH ?= github.com/src-d/gitbase/...
36
37
static-build :
37
- go install - v $(GO_BUILD_ARGS ) github.com/src-d/gitbase/...
38
+ go build -ldflags= " $( LD_FLAGS ) " - v $(GO_BUILD_ARGS ) $( GO_BUILD_PATH )
38
39
39
40
ci-e2e : packages
40
41
go test ./e2e -gitbase-version=" $( TRAVIS_TAG) " \
You can’t perform that action at this time.
0 commit comments