forked from martin-sicho/genui-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·51 lines (44 loc) · 1.76 KB
/
build.sh
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
49
50
51
#!/bin/bash
set -e
while getopts ":r:t:c:" opt; do
case $opt in
r) REPO="$OPTARG"
;;
t) TAG="$OPTARG"
;;
c) CUDA_RUNFILE="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
REPO_PREFIX=${REPO:-"sichom"}
TAG=${TAG:-"latest"}
CUDA_RUNFILE=${CUDA_RUNFILE:-""}
printf "TAG is %s\n" "$TAG"
printf "REPO is %s\n" "$REPO"
if [ -z "$CUDA_RUNFILE" ]
then
echo "No CUDA runfile specified. GPU images will not be built."
else
printf "CUDA images will be built with the following CUDA runfile: %s\n" "$CUDA_RUNFILE"
fi
read -p "Do you want to proceed? Type YES to confirm: " userInput
if [[ $userInput != 'YES' ]] || [[ $userInput == '' ]]; then
echo "Build cancelled by user."
exit 1
else
echo "Building images..."
fi
docker build -t ${REPO_PREFIX}/genui-base:${TAG} -f Dockerfile-base .
docker build --build-arg GENUI_DOCKER_IMAGE_PREFIX=${REPO_PREFIX} --build-arg GENUI_DOCKER_IMAGE_TAG=${TAG} -t ${REPO_PREFIX}/genui-main:${TAG} -f Dockerfile-main .
docker build --build-arg GENUI_DOCKER_IMAGE_PREFIX=${REPO_PREFIX} --build-arg GENUI_DOCKER_IMAGE_TAG=${TAG} -t ${REPO_PREFIX}/genui-worker:${TAG} -f Dockerfile-worker .
if [ -z "$CUDA_RUNFILE" ]
then
echo "No CUDA runfile specified. GPU images were not built."
exit 1
else
printf "Building CUDA images with the following CUDA runfile: %s\n" "$CUDA_RUNFILE"
docker build --build-arg GENUI_DOCKER_IMAGE_PREFIX=${REPO_PREFIX} --build-arg GENUI_DOCKER_IMAGE_TAG=${TAG} --build-arg NVIDIA_CUDA_RUNFILE=${CUDA_RUNFILE} -t ${REPO_PREFIX}/genui-base-cuda:${TAG} -f Dockerfile-base-cuda .
docker build --build-arg GENUI_DOCKER_IMAGE_PREFIX=${REPO_PREFIX} --build-arg GENUI_DOCKER_IMAGE_TAG=${TAG} -t ${REPO_PREFIX}/genui-gpuworker:${TAG} -f Dockerfile-gpuworker .
fi