-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·93 lines (74 loc) · 1.85 KB
/
run.sh
File metadata and controls
executable file
·93 lines (74 loc) · 1.85 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
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
#!/bin/sh -x
export NAME=heatmap-$(id -un)
if [ -z ${WORKSPACE} ]
then
HERE=$(dirname $0)
else
HERE=${WORKSPACE}
fi
if [ "${DOCKER_IMAGE_NAME}x" = "x" ]
then
export DOCKER_IMAGE_NAME=hakan42/flight-heatmap
fi
export DOCKER_IMAGE=${DOCKER_IMAGE_NAME}:latest
DATA=${HERE}/data
DATA=$(realpath ${DATA})
BOUNDS=${HERE}/bounds
BOUNDS=$(realpath ${BOUNDS})
OUTPUT=${HERE}/output
OUTPUT=$(realpath ${OUTPUT})
if [ -r ${HERE}/secrets.sh ]
then
. ${HERE}/secrets.sh
fi
SHELL_MODE="-it"
ARGUMENTS=""
YEARS=""
for arg in $@
do
case "${arg}" in
-s|--shell)
SHELL_MODE="-it --entrypoint /bin/bash"
;;
-d|--docker)
SHELL_MODE=""
;;
-a|--all)
for d in ${DATA}/*
do
YEARS="${YEARS} $(basename ${d})"
done
;;
*)
YEARS="${YEARS} ${arg}"
;;
esac
done
if [ -z "${YEARS}" ]
then
YEARS="2024 2024-08 2024-08-30 2024-09"
fi
for YEAR in ${YEARS}
do
rm -rf ${OUTPUT}/${YEAR}
mkdir -p ${OUTPUT}/${YEAR}
if [ -r ${BOUNDS}/${YEAR}/bounds.json ]
then
cp ${BOUNDS}/${YEAR}/bounds.json ${OUTPUT}/${YEAR}/bounds.json
fi
echo ${YEAR} > ${OUTPUT}/${YEAR}/title.txt
docker run \
--rm \
${SHELL_MODE} \
--name ${NAME} \
--hostname ${NAME} \
--env USER_ID=$(id -u) \
--env MAPBOX_API_KEY=${MAPBOX_API_KEY} \
--env OPENAIP_API_KEY=${OPENAIP_API_KEY} \
--volume /etc/localtime:/etc/localtime:ro \
--volume /etc/timezone:/etc/timezone:ro \
--volume /etc/resolv.conf:/etc/resolv.conf:ro \
--mount type=bind,source=${DATA}/${YEAR},target=/app/gpx_files \
--mount type=bind,source=${OUTPUT}/${YEAR},target=/app/output \
${DOCKER_IMAGE}
done