blob: 964a570b6da7bc78bb093604ee3331ceb1e13652 [file] [log] [blame]
Yi Tsengaae6ef52021-09-01 13:48:27 -07001#!/bin/bash
2# SPDX-FileCopyrightText: Copyright 2021-present Open Networking Foundation.
3# SPDX-License-Identifier: Apache-2.0
4# Usage:
5# ./build.sh [--wk] [--di]
6#
7# Options:
8# --wk: with user's SSH key.
9# --di: with DeepInsight utility library(from a private repo)
10
11set -euo pipefail
12
13THIS_DIR="$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)"
14TEST_ON_DIR="$(cd ${THIS_DIR}/.. && pwd)"
15CONTAINER_FS="${THIS_DIR}/fs"
16DI_UTIL_REPO="git@github.com:opennetworkinglab/bf-di-scripts.git"
pierventreef5e1d12022-02-21 15:32:55 -080017ENV="macos"
Yi Tsengaae6ef52021-09-01 13:48:27 -070018
19mkdir -p "${CONTAINER_FS}/tmp"
20rm -rf "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
21touch "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
22
23for op in $@; do
24 case $op in
25 '--wk' )
26 rm -rf "${CONTAINER_FS}/home/jenkins/.ssh"
27 cp -r "${HOME}/.ssh" "${CONTAINER_FS}/home/jenkins/.ssh"
28 ;;
29 '--di' )
30 rm -rf "${CONTAINER_FS}/tmp/bf-di-scripts"
31 git clone "${DI_UTIL_REPO}" "${CONTAINER_FS}/tmp/bf-di-scripts"
32 echo "/tmp/bf-di-scripts/4/utility" > "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
33 ;;
pierventreef5e1d12022-02-21 15:32:55 -080034 '--li' )
35 ENV="linux"
36 ;;
Yi Tsengaae6ef52021-09-01 13:48:27 -070037 esac
38done
39
pierventreef5e1d12022-02-21 15:32:55 -080040docker build -t teston -f "${THIS_DIR}/Dockerfile" "${TEST_ON_DIR}" --build-arg ENV=$ENV