Skip to content

Commit a030c3a

Browse files
authored
Merge pull request #512 from mcarmonaa/fix/add-gitbase-version-to-docker-image
Dockerfile: add gitbase version to the binary
2 parents f849578 + 5386887 commit a030c3a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN apk add --update libxml2-dev git make bash gcc g++ curl oniguruma-dev
88
RUN go get github.com/golang/dep/...
99
RUN dep ensure
1010
RUN cd vendor/gopkg.in/bblfsh/client-go.v2 && make dependencies
11-
RUN go install -v -tags oniguruma -ldflags "-linkmode external -extldflags '-static -lz'" github.com/src-d/gitbase/...
11+
RUN make static-build
1212

1313
FROM alpine:3.8
1414

Diff for: Makefile

+7
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ static-package:
3434
cd build && \
3535
tar czvf $${PACKAGE_NAME}.tar.gz $${PACKAGE_NAME} && \
3636
docker rm gitbase-temp
37+
38+
# target used in the Dockerfile to build the static binary
39+
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))
40+
static-build: LD_FLAGS += -linkmode external -extldflags '-static -lz'
41+
static-build: GO_BUILD_ARGS += -tags oniguruma
42+
static-build:
43+
go install -v $(GO_BUILD_ARGS) github.com/src-d/gitbase/...

0 commit comments

Comments
 (0)