blob: 80ee81c821bb780e953ffb37edd654340968835b (
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
47
48
|
#!/bin/sh
set -e
set -x
##
# Package version needs to be decimal
##
##
# Set GITREV=0 or similar in ENV if you want the tag to just be updated to -0
# everytime for automation usage/scripts/etc locally.
#
# Ex) GITREV=0 ./build.sh
##
GITREV="${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 \
.
# Keep .apk files for debugging purposes, docker image as well.
docker build \
--pull \
--file=docker/alpine/Dockerfile \
--build-arg="PKGVER=$PKGVER" \
--tag="frr:alpine-apk-builder-$GITREV" \
--target=alpine-apk-builder \
.
CONTAINER_ID="$(docker create "frr:alpine-apk-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"
docker rmi "frr:alpine-apk-builder-$GITREV"
|