blob: e9a968d123eb6942d68fed46ebdc44a2fc09694d [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"
17
18mkdir -p "${CONTAINER_FS}/tmp"
19rm -rf "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
20touch "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
21
22for op in $@; do
23 case $op in
24 '--wk' )
25 rm -rf "${CONTAINER_FS}/home/jenkins/.ssh"
26 cp -r "${HOME}/.ssh" "${CONTAINER_FS}/home/jenkins/.ssh"
27 ;;
28 '--di' )
29 rm -rf "${CONTAINER_FS}/tmp/bf-di-scripts"
30 git clone "${DI_UTIL_REPO}" "${CONTAINER_FS}/tmp/bf-di-scripts"
31 echo "/tmp/bf-di-scripts/4/utility" > "${CONTAINER_FS}/tmp/additional-py-pkgs.txt"
32 ;;
33 esac
34done
35
36docker build -t teston -f "${THIS_DIR}/Dockerfile" "${TEST_ON_DIR}"