-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.sh
executable file
·131 lines (110 loc) · 3.23 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/bin/bash
#
# This file is part of SITS Docker.
# Copyright (C) 2023 INPE.
#
# SITS Docker is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
set -eou pipefail
cd docker
#
# General variables
#
SITS_BUILD_MODE=""
SITS_TAG_VERSION="1.4.1"
SITS_TAG_PREFIX="brazildatacube"
SITS_TAG_NOTEBOOKS_REPO="1.1.0"
SITS_NOTEBOOKS_REPO="e-sensing/sitsnotebooks.git"
SITSDATA_COMMIT_REF="6da4443d88c7eca88ab3b94d5bdaad3c8b60d223"
SITS_ENVIRONMENT_TYPE="full"
SITS_UBUNTU_VERSION="20.04"
#
# General functions
#
usage() {
echo "Usage: $0 [-n] [-t <${SITS_TAG_VERSION}>] [-p <brazildatacube|registry.dpi.inpe.br>] [-e <full|minimal>]" 1>&2;
exit 1;
}
#
# Get build options
#
while getopts "nt:p:he:" o; do
case "${o}" in
e)
SITS_ENVIRONMENT_TYPE=${OPTARG}
;;
n)
SITS_BUILD_MODE="--no-cache"
;;
p)
SITS_TAG_PREFIX=${OPTARG}
;;
t)
SITS_TAG_VERSION=${OPTARG}
;;
h)
usage
;;
*)
usage
;;
esac
done
#
# Build a image with all the dependencies already installed
#
echo "Building base image for SITS..."
cd base
SITS_BASE_IMAGE="jupyter/base-notebook:ubuntu-${SITS_UBUNTU_VERSION}"
SITS_BASE_IMAGE_TAG="${SITS_TAG_PREFIX}/sits-base:${SITS_TAG_VERSION}"
docker build ${SITS_BUILD_MODE} \
--build-arg BASE_IMAGE=${SITS_BASE_IMAGE} \
-t ${SITS_BASE_IMAGE_TAG} \
--file Dockerfile .
#
# Build R image with all the package dependencies already installed
#
echo "Building base R image for SITS..."
cd ../r
SITS_R_DOCKER_IMAGE_TAG="${SITS_TAG_PREFIX}/sits-r:${SITS_TAG_VERSION}"
docker build ${SITS_BUILD_MODE} \
--build-arg BASE_IMAGE=${SITS_BASE_IMAGE_TAG} \
--build-arg SITS_TAG_VERSION=v${SITS_TAG_VERSION} \
--build-arg SITS_ENVIRONMENT_TYPE=${SITS_ENVIRONMENT_TYPE} \
-t ${SITS_R_DOCKER_IMAGE_TAG} \
--file Dockerfile .
#
# Build final SITS image
#
echo "Building SITS image..."
cd ../sits
SITS_DOCKER_IMAGE_TAG="${SITS_TAG_PREFIX}/sits:${SITS_TAG_VERSION}"
docker build ${SITS_BUILD_MODE} \
--build-arg BASE_IMAGE=${SITS_R_DOCKER_IMAGE_TAG} \
--build-arg SITS_TAG_VERSION=v${SITS_TAG_VERSION} \
--build-arg SITSDATA_COMMIT_REF=${SITSDATA_COMMIT_REF} \
-t ${SITS_DOCKER_IMAGE_TAG} \
--file Dockerfile .
#
# Build RStudio for SITS image
#
echo "Building RStudio for SITS image..."
cd ../rstudio
SITS_RSTUDIO_DOCKER_IMAGE_TAG="${SITS_TAG_PREFIX}/sits-rstudio:${SITS_TAG_VERSION}"
docker build ${SITS_BUILD_MODE} \
--build-arg BASE_IMAGE=${SITS_DOCKER_IMAGE_TAG} \
-t ${SITS_RSTUDIO_DOCKER_IMAGE_TAG} \
--file Dockerfile .
#
# Build Jupyter for SITS image
#
echo "Building Jupyter for SITS image..."
cd ../jupyter
SITS_JUPYTER_DOCKER_IMAGE_TAG="${SITS_TAG_PREFIX}/sits-jupyter:${SITS_TAG_VERSION}"
docker build ${SITS_BUILD_MODE} \
--build-arg BASE_IMAGE=${SITS_RSTUDIO_DOCKER_IMAGE_TAG} \
--build-arg SITS_TAG_NOTEBOOKS_REPO=v${SITS_TAG_NOTEBOOKS_REPO} \
--build-arg SITS_NOTEBOOKS_REPO=${SITS_NOTEBOOKS_REPO} \
-t ${SITS_JUPYTER_DOCKER_IMAGE_TAG} \
--file Dockerfile .