forked from basis-company/tarantool-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·29 lines (23 loc) · 1.01 KB
/
build.sh
File metadata and controls
executable file
·29 lines (23 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# This script is for local builds.
# It gathers version information from the local .git repository
# and passes it as build arguments to the docker build command.
# It also tags the resulting image with the git tag or short SHA.
set -e
# --- Version Information ---
CI_COMMIT_TAG=$(git describe --tags --always)
CI_COMMIT_REF_NAME=$(git rev-parse --abbrev-ref HEAD)
CI_COMMIT_SHA=$(git rev-parse --verify HEAD)
CI_COMMIT_SHORT_SHA=$(git rev-parse --verify --short HEAD)
# --- Docker Image Tagging ---
IMAGE_NAME="basiscompany/tarantool-admin"
# Use git tag if on a tagged commit, otherwise use short SHA
IMAGE_TAG=$(git describe --tags --exact-match 2>/dev/null || echo "$CI_COMMIT_SHORT_SHA")
echo "Building image: $IMAGE_NAME:$IMAGE_TAG"
docker build . \
--build-arg CI_COMMIT_TAG="$CI_COMMIT_TAG" \
--build-arg CI_COMMIT_REF_NAME="$CI_COMMIT_REF_NAME" \
--build-arg CI_COMMIT_SHA="$CI_COMMIT_SHA" \
--build-arg CI_COMMIT_SHORT_SHA="$CI_COMMIT_SHORT_SHA" \
-t "$IMAGE_NAME:$IMAGE_TAG" \
"$@"