summaryrefslogtreecommitdiffstats
path: root/docker/centos-8/build.sh
blob: 4a9918486c8ce0a266ebeaaacf11567671a28530 (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
#!/bin/sh

set -e

##
# Package version needs to be decimal
##
GITREV="$(git rev-parse --short=10 HEAD)"
PKGVER="$(printf '%u\n' 0x$GITREV)"

mkdir -p docker/centos-8/pkgs
docker build \
	--file=docker/centos-8/Dockerfile \
	--build-arg="PKGVER=$PKGVER" \
	--tag="frr:centos-8-builder-$GITREV" \
	--target=centos-8-builder \
	.

# Copy RPM package from container to host
CONTAINER_ID="$(docker create "frr:centos-8-builder-$GITREV")"
docker cp "${CONTAINER_ID}:/rpmbuild/RPMS/x86_64/" docker/centos-8/pkgs
docker rm "${CONTAINER_ID}"

docker build \
	--cache-from="frr:centos-8-builder-$GITREV" \
	--file=docker/centos-8/Dockerfile \
	--build-arg="PKGVER=$PKGVER" \
	--tag="frr:centos-8-$GITREV" \
	.

docker rmi "frr:centos-8-builder-$GITREV"