forked from luigifreda/rosdocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·44 lines (36 loc) · 1.01 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
#!/usr/bin/env bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
SCRIPT_DIR=$(readlink -f $SCRIPT_DIR) # this reads the actual path if a symbolic directory is used
# Check args
if [ "$#" -ne 1 ]; then
echo "usage: ./build.sh CONTAINER_NAME"
return 1
fi
export CONTAINER_NAME=$1
source config.sh
echo building container $CONTAINER_NAME with $DOCKER_FILE
sleep 1
TIMEZONE=""
case "$OSTYPE" in
darwin*)
TIMEZONE=$(sudo systemsetup -gettimezone | sed 's/^Time Zone: //')
;;
linux*)
TIMEZONE=$(cat /etc/timezone)
;;
*)
echo "";
;;
esac
# Build the docker image (update the nvidia driver version if needed)
docker build -f "$DOCKER_FILE" --rm\
--build-arg user=$USER\
--build-arg uid=$UID\
--build-arg home=$HOME\
--build-arg workspace=$SCRIPT_DIR\
--build-arg shell=$SHELL\
--build-arg nvidia_driver_version="$NVIDIA_DRIVER_VERSION"\
--build-arg container_name=$CONTAINER_NAME\
--build-arg timezone=$TIMEZONE\
-t $CONTAINER_NAME .