Skip to content

Commit

Permalink
fixed issue with Docker hub making only shallow clone, reorganized bu…
Browse files Browse the repository at this point in the history
…ild scripts
  • Loading branch information
darklynx committed Jan 17, 2019
1 parent b57a56d commit 5861b7d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
3 changes: 1 addition & 2 deletions docker/multistage/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
FROM golang:latest as builder
WORKDIR /go/src/rbaskets
COPY . .
RUN set -e \
&& GIT_VERSION="$(git describe)" \
RUN GIT_VERSION="$(git describe || git symbolic-ref -q --short HEAD)" \
&& GIT_COMMIT="$(git rev-parse HEAD)" \
&& GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)" \
&& set -x \
Expand Down
1 change: 1 addition & 0 deletions build.sh → scripts/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e

# change current dir to the script dir
cd "$(dirname "$0")"
cd ../..

GIT_VERSION="$(git describe)"
GIT_COMMIT="$(git rev-parse HEAD)"
Expand Down
10 changes: 10 additions & 0 deletions scripts/build/build_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

# exit if any step fails
set -e

# change current dir to the script dir
cd "$(dirname "$0")"
cd ../..

docker build -f docker/multistage/Dockerfile -t request-baskets .
15 changes: 15 additions & 0 deletions scripts/build/build_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# exit if any step fails
set -e

# change current dir to the script dir
cd "$(dirname "$0")"
cd ../..

GIT_VERSION="$(git describe)"
GIT_COMMIT="$(git rev-parse HEAD)"
GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)"

# build service with version information
env GOOS=linux GOARCH=amd64 go build -ldflags "-X main.GitVersion=${GIT_VERSION} -X main.GitCommit=${GIT_COMMIT} -X main.GitCommitShort=${GIT_COMMIT_SHORT}"

0 comments on commit 5861b7d

Please sign in to comment.