summaryrefslogtreecommitdiffstats
path: root/docker/alpine/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'docker/alpine/build.sh')
-rwxr-xr-xdocker/alpine/build.sh33
1 files changed, 23 insertions, 10 deletions
diff --git a/docker/alpine/build.sh b/docker/alpine/build.sh
index 5a79ebcdc..22a36877c 100755
--- a/docker/alpine/build.sh
+++ b/docker/alpine/build.sh
@@ -1,17 +1,30 @@
#!/bin/sh
set -e
-set -v
set -x
##
-# commit must be converted to decimal
+# Package version needs to be decimal
##
-c=`git rev-parse --short=10 HEAD`
-commit=`printf '%u\n' 0x$c`
-docker build -f docker/alpine/Dockerfile \
- --build-arg commit=$commit -t frr:alpine-$c .
-id=`docker create frr:alpine-$c`
-docker cp ${id}:/pkgs/ docker/alpine
-docker rm $id
-docker rmi frr:alpine-$c
+GITREV="$(git rev-parse --short=10 HEAD)"
+PKGVER="$(printf '%u\n' 0x$GITREV)"
+
+docker build \
+ --pull \
+ --file=docker/alpine/Dockerfile \
+ --build-arg="PKGVER=$PKGVER" \
+ --tag="frr:alpine-builder-$GITREV" \
+ --target=alpine-builder \
+ .
+
+CONTAINER_ID="$(docker create "frr:alpine-builder-$GITREV")"
+docker cp "${CONTAINER_ID}:/pkgs/" docker/alpine
+docker rm "${CONTAINER_ID}"
+
+docker build \
+ --file=docker/alpine/Dockerfile \
+ --build-arg="PKGVER=$PKGVER" \
+ --tag="frr:alpine-$GITREV" \
+ .
+
+docker rmi "frr:alpine-builder-$GITREV"