-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·63 lines (54 loc) · 1.92 KB
/
build.sh
File metadata and controls
executable file
·63 lines (54 loc) · 1.92 KB
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
#!/bin/bash
CONTAINER_TYPE="base"
PYTHON_VERSION="3.7"
UBUNTU_VERSION="18.04"
INSTALL_CUDA=false
INSTALL_PHANTOM_JS=false
CONTAINER_VERSION="latest"
# Parse args
POSITIONAL=()
while [[ $# -gt 0 ]]
do
case "$1" in
-py | --python ) PYTHON_VERSION="$2"; shift 2;;
-cu | --cuda ) INSTALL_CUDA=true; shift;;
-ba | --base ) INSTALL_CUDA=false; shift;;
-j | -js | --phantomjs ) INSTALL_PHANTOM_JS=true; shift;;
-cn | --container-name) CONTAINER_NAME="$2"; shift 2;;
-v | --version) CONTAINER_VERSION="$2"; shift 2;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
if [ "${PYTHON_VERSION}" = "3.8" ] || [ "${PYTHON_VERSION}" = "3.9" ]; then UBUNTU_VERSION="20.04"
fi
if [ "${INSTALL_CUDA}" = "true" ]; then \
CONTAINER_TYPE="cuda";
fi
echo "Building docker container:";
echo "Container type:" ${CONTAINER_TYPE};
echo "Container version": "${CONTAINER_VERSION}";
echo "Ubuntu version:" ${UBUNTU_VERSION};
echo "Python version:" "${PYTHON_VERSION}";
echo "Install Phantom js:" ${INSTALL_PHANTOM_JS};
if [ "${INSTALL_CUDA}" = "true" ]; then \
export CONTAINER_NAME=fragiletech/ubuntu"${UBUNTU_VERSION}"-cuda-11.0-py"${PYTHON_VERSION//.}":${CONTAINER_VERSION}
else
export CONTAINER_NAME=fragiletech/ubuntu"${UBUNTU_VERSION}"-base-py"${PYTHON_VERSION//.}":${CONTAINER_VERSION}
fi
echo "CONTAINER NAME" ${CONTAINER_NAME};
if [ "${INSTALL_CUDA}" = "true" ]; then \
docker build --pull -t "${CONTAINER_NAME}" \
-f base-cuda.dockerfile . \
--build-arg INSTALL_PHANTOM_JS=${INSTALL_PHANTOM_JS} \
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
--build-arg UBUNTU_VERSION=${UBUNTU_VERSION};
else \
docker build --pull -t "${CONTAINER_NAME}" \
-f base-python.dockerfile . \
--build-arg INSTALL_PHANTOM_JS=${INSTALL_PHANTOM_JS} \
--build-arg PYTHON_VERSION=${PYTHON_VERSION} \
--build-arg UBUNTU_VERSION=${UBUNTU_VERSION};
fi