Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ jobs:
services: [docker]

before_deploy:
- make packages
- echo "${TRAVIS_TAG}" > version.txt
- make static-package
- make docker-push-latest-release

deploy:
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ FROM golang:1.11-alpine as builder
ENV GITBASE_REPO=github.com/src-d/gitbase
ENV GITBASE_PATH=$GOPATH/src/$GITBASE_REPO

RUN apk add --no-cache git
RUN apk add --update --no-cache libxml2-dev git make bash gcc g++ curl oniguruma-dev oniguruma

COPY . $GITBASE_PATH
WORKDIR $GITBASE_PATH
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

ENV GO_BUILD_ARGS="-o /bin/gitbase"
ENV GO_BUILD_PATH="./cmd/gitbase"
RUN make static-build

#=================================
# Stage 2: Start Gitbase Server
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ static-package:
docker rm gitbase-temp

# target used in the Dockerfile to build the static binary
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))
static-build: LD_FLAGS += -linkmode external -extldflags '-static -lz'
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)")
static-build: LD_FLAGS += -linkmode external -extldflags '-static -lz' -s -w
static-build: GO_BUILD_ARGS += -tags oniguruma
static-build: GO_BUILD_PATH ?= github.com/src-d/gitbase/...
static-build:
go install -v $(GO_BUILD_ARGS) github.com/src-d/gitbase/...
go build -ldflags="$(LD_FLAGS)" -v $(GO_BUILD_ARGS) $(GO_BUILD_PATH)

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