summaryrefslogtreecommitdiffstats
path: root/docker/centos-8/build.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdocker/centos-8/build.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/docker/centos-8/build.sh b/docker/centos-8/build.sh
new file mode 100755
index 0000000..4a99184
--- /dev/null
+++ b/docker/centos-8/build.sh
@@ -0,0 +1,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"