Skip to content

Commit 9a272d6

Browse files
authored
Merge pull request #735 from ajnavarro/compile-fat-binary
Add oniguruma bindings into generated gitbase binary
2 parents 8c6f7d6 + 892ce2e commit 9a272d6

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ jobs:
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:

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ FROM golang:1.11-alpine as builder
66
ENV GITBASE_REPO=github.com/src-d/gitbase
77
ENV 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

1111
COPY . $GITBASE_PATH
1212
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
1417

1518
#=================================
1619
# Stage 2: Start Gitbase Server

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff 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
3535
static-build: GO_BUILD_ARGS += -tags oniguruma
36+
static-build: GO_BUILD_PATH ?= github.com/src-d/gitbase/...
3637
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)
3839

3940
ci-e2e: packages
4041
go test ./e2e -gitbase-version="$(TRAVIS_TAG)" \

0 commit comments

Comments
 (0)