forked from IkuoShige/Nvidia-sdkmanager-docker-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_docker_images.sh
executable file
·73 lines (66 loc) · 2.04 KB
/
build_docker_images.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Usage
# 使用方法
# ./build_docker_images.sh --ubuntu-version 20.04 --docker-version 1.9.3.10904
# ex)./build_docker_images.sh --ubuntu-version <distribution> --docker-version <sdkmanager-version>
# ヘルプメッセージを表示する関数
# Function to display help messages
function show_help {
echo "Usage: $0 [options]"
echo "Options:"
echo " -h, --help Show this help message and exit"
echo " --ubuntu18 Use Ubuntu 18.04 as the base image"
echo " --docker-version Set the sdkmanager docker version. Pick up <sdkmanager-docker-version> in the sdkmanager-<sdkmanager-docker-version>-ubuntu_<distr>_docker.tar.gz"
echo " --uid Set the UID for the user in the container"
echo " --gid Set the GID for the user in the container"
}
# デフォルトのオプション
# Default options
DISTR="20.04"
USER_UID=$(id -u)
USER_GID=$(id -g)
SDK_MANAGER_VERSION=""
SDK_MANAGER_DOCKER_VERSION=""
DEB_FILE=""
# コマンドライン引数を解析
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-h|--help)
show_help
exit 0
;;
--ubuntu-version)
DISTR="$2"
shift
;;
--uid)
USER_UID="$2"
shift 2
;;
--gid)
USER_GID="$2"
shift 2
;;
--docker-version)
SDK_MANAGER_DOCKER_VERSION="$2"
shift 2
;;
*)
shift
;;
esac
done
# ビルド実行
# Execute the build process
echo "Building Docker image with base image: ${DISTR}, SDK Manager version: ${SDK_MANAGER_VERSION}"
docker build \
--build-arg SDK_MANAGER_VERSION=${SDK_MANAGER_VERSION} \
--build-arg SDK_MANAGER_DOCKER_VERSION=${SDK_MANAGER_DOCKER_VERSION} \
--build-arg UID=${USER_UID} \
--build-arg GID=${USER_GID} \
--build-arg DISTR=${DISTR} \
-t sdkmanager_gui_${DISTR} \
-f Dockerfile \
.
echo "Done."