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 3838 services : [docker]
3939
4040 before_deploy :
41- - make packages
42- - echo "${TRAVIS_TAG}" > version.txt
41+ - make static-package
4342 - make docker-push-latest-release
4443
4544 deploy :
Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ FROM golang:1.11-alpine as builder
66ENV GITBASE_REPO=github.com/src-d/gitbase
77ENV GITBASE_PATH=$GOPATH/src/$GITBASE_REPO
88
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
1010
1111COPY . $GITBASE_PATH
1212WORKDIR $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
1417
1518# =================================
1619# Stage 2: Start Gitbase Server
Original file line number Diff line number Diff line change @@ -30,11 +30,12 @@ static-package:
3030 docker rm gitbase-temp
3131
3232# 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
3535static-build : GO_BUILD_ARGS += -tags oniguruma
36+ static-build : GO_BUILD_PATH ?= github.com/src-d/gitbase/...
3637static-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 )
3839
3940ci-e2e : packages
4041 go test ./e2e -gitbase-version=" $( TRAVIS_TAG) " \
You can’t perform that action at this time.
0 commit comments