Skip to content

Commit 63dcc86

Browse files
authored
Merge pull request #665 from erizocosmico/fix/docker-img-version
ci: fix versions of docker image binary
2 parents b1e22fa + 77be9de commit 63dcc86

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535

3636
before_deploy:
3737
- make packages
38+
- echo "${TRAVIS_TAG}" > version.txt
3839
- make docker-push-latest-release
3940

4041
deploy:

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#================================
22
# Stage 1: Build Gitbase
33
#================================
4-
FROM golang:1.11-alpine as gitbase-build
4+
FROM golang:1.11-alpine as builder
55

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
10+
911
COPY . $GITBASE_PATH
1012
WORKDIR $GITBASE_PATH
11-
RUN go build -ldflags="-s -w" -o /bin/gitbase ./cmd/gitbase
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
1214

1315
#=================================
1416
# Stage 2: Start Gitbase Server
@@ -28,7 +30,7 @@ RUN chmod +x /tini
2830
ENTRYPOINT ["/tini", "--"]
2931

3032
# copy build artifacts
31-
COPY --from=gitbase-build /bin/gitbase /bin/gitbase
33+
COPY --from=builder /bin/gitbase /bin/gitbase
3234

3335
CMD /bin/gitbase server -v \
3436
--host=0.0.0.0 \

0 commit comments

Comments
 (0)