mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-09 14:56:14 +00:00

Add ability to set your own env for the version of the docker container alpine image. This is useful for applications like GNS3 who pin a specific version to look for when they boot up. When you build locally to test your code you can just set the version to 0 so you don't have to update configs/scripts looking for a specific image version. Also fix a shebang in docker start for alpine. Signed-off-by: Stephen Worley <sworley@nvidia.com>
39 lines
784 B
Bash
Executable File
39 lines
784 B
Bash
Executable File
#!/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 \
|
|
.
|
|
|
|
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"
|