Skip to content

Commit

Permalink
docker: Include git repo info when running build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
lutter committed May 26, 2020
1 parent 108ca27 commit f3301a4
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#! /bin/bash

# This file is only here to ease testing/development. The commands in this
# file should ultimately be moved to the corresponding commands for Cloud Build
# in the cloudbuild.*.yaml files
# This file is only here to ease testing/development. Official images are
# built using the 'cloudbuild.yaml' file

type -p podman > /dev/null && docker=podman || docker=docker

cd $(dirname $0)/..

if [ -d .git ]
then
COMMIT_SHA=$(git rev-parse HEAD)
TAG_NAME=$(git tag --points-at HEAD)
REPO_NAME="Checkout of $(git remote get-url origin) at $(git describe --dirty)"
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
fi
for stage in graph-node-build graph-node graph-node-debug
do
$docker build -t $stage --target $stage -f docker/Dockerfile .
$docker build --target $stage \
--build-arg "COMMIT_SHA=$COMMIT_SHA" \
--build-arg "REPO_NAME=$REPO_NAME" \
--build-arg "BRANCH_NAME=$BRANCH_NAME" \
--build-arg "TAG_NAME=$TAG_NAME" \
-t $stage \
-f docker/Dockerfile .
done

0 comments on commit f3301a4

Please sign in to comment.