forked from tkestack/vcuda-controller
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-img.sh
More file actions
executable file
·31 lines (25 loc) · 810 Bytes
/
build-img.sh
File metadata and controls
executable file
·31 lines (25 loc) · 810 Bytes
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
#!/bin/bash
set -o errexit
set -o pipefail
set -o nounset
set -o xtrace
ROOT=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd -P)
IMAGE_FILE=${IMAGE_FILE:-"tkestack.io/gaia/vcuda:latest"}
function cleanup() {
rm -rf ${ROOT}/cuda-control.tar
}
trap cleanup EXIT SIGTERM SIGINT
function build_img() {
readonly local commit=$(git log --oneline | wc -l | sed -e 's,^[ \t]*,,')
readonly local version=$(<"${ROOT}/VERSION")
rm -rf ${ROOT}/build
mkdir ${ROOT}/build
git archive -o ${ROOT}/build/cuda-control.tar --format=tar --prefix=cuda-control/ HEAD
cp ${ROOT}/vcuda.spec ${ROOT}/build
cp ${ROOT}/Dockerfile ${ROOT}/build
(
cd ${ROOT}/build
docker build ${BUILD_FLAGS:-} --build-arg version=${version} --build-arg commit=${commit} -t ${IMAGE_FILE} .
)
}
build_img