summaryrefslogtreecommitdiffstats
path: root/docker/ubi-8/build.sh
blob: 0216636893af95a88052cd9e0b6b2001d05e713b (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

set -e

##
# Package version needs to be decimal
##
DISTRO=ubi-8

GITREV="$2"
if [ -z "$GITREV" ];then
	GITREV="$(git rev-parse --short=10 HEAD)"
fi

FRR_IMAGE_TAG="$1"
if [ -z $FRR_IMAGE_TAG ];then
	FRR_IMAGE_TAG="frr:ubi-8-$GITREV"
fi
PKGVER="$(printf '%u\n' 0x$GITREV)"

FRR_RELEASE="$3"
if [ -z $FRR_RELEASE ];then
	FRR_RELEASE=$(git describe --tags --abbrev=0)
fi

FRR_NAME=$4
if [ -z $FRR_NAME ];then
	FRR_NAME=frr
fi

FRR_VENDOR=$5
if [ -z $FRR_VENDOR ];then
	FRR_VENDOR=frr
fi

docker build \
	--cache-from="frr:$DISTRO-builder-$GITREV" \
	--file=docker/$DISTRO/Dockerfile \
	--build-arg="PKGVER=$PKGVER" \
	--build-arg="FRR_IMAGE_TAG=$FRR_IMAGE_TAG" \
	--build-arg="FRR_RELEASE=$FRR_RELEASE" \
	--build-arg="FRR_NAME=$FRR_NAME" \
	--build-arg="FRR_VENDOR=$FRR_VENDOR" \
	--tag="$FRR_IMAGE_TAG" \
	.