-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_custom_script_in_docker_image.sh
More file actions
executable file
·49 lines (45 loc) · 1.13 KB
/
run_custom_script_in_docker_image.sh
File metadata and controls
executable file
·49 lines (45 loc) · 1.13 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
#!/bin/bash
# Bash script to run a local python script in the pdal_ign_plugin docker image
while [[ $# -gt 0 ]]; do
case $1 in
-i|--input_file)
input_dir=$(realpath $(dirname "$2"))
input_filename=$(basename "$2")
shift # past argument
shift # past value
;;
-o|--output_dir)
output_dir=$(realpath "$2")
shift # past argument
shift # past value
;;
-s|--script)
script_dir=$(realpath $(dirname "$2"))
script_filename=$(basename "$2")
shift # past argument
shift # past value
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
echo "Run script:"
echo "* dir=${script_dir}"
echo "* name=${script_filename}"
echo "on file:"
echo "* dir=${input_dir}"
echo "* name=${input_filename}"
echo "save output to:"
echo "* dir=${output_dir}"
echo "* name=${input_filename}"
echo "--------"
docker run --rm --userns=host \
-v ${input_dir}:/input \
-v ${output_dir}:/output \
-v ${script_dir}:/script \
ghcr.io/ignf/pdal-ign-plugin:latest \
python /script/${script_filename} \
-i /input/${input_filename} \
-o /output/${input_filename}