forked from asbi-cds-tools/asbi-screening-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-entrypoint.sh
executable file
·51 lines (37 loc) · 1.08 KB
/
docker-entrypoint.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
#!/bin/sh
set -e
repo_path="$(cd "$(dirname "$0")" && pwd)"
cmdname="$(basename "$0")"
usage() {
cat << USAGE >&2
Usage:
$cmdname command
Docker entrypoint script
Wrapper script that executes docker-related tasks before running given command
USAGE
exit 1
}
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
exit 0
fi
write_env_to_json() {
# write project-specific environment variables to app config file
local json_file="$1"
# only write environment variables frontend will read (beginning with "REACT_" or "VUE_")
local json_contents="{$(printenv | grep -e REACT_ -e VUE_ | sed 's/^\|$/"/g' | sed 's|=|":"|' | paste -sd, -)}"
echo "$json_contents" > "$json_file"
}
write_env_to_json /usr/share/nginx/html/env.json
# TODO remove when FHIR resources are PUT after SoF launch
if [ -n "$FHIR_SERVER" ]; then
echo Uploading files:
find /var/opt
# run python upload script
/var/opt/upload.py "$FHIR_SERVER"
else
echo FHIR_SERVER not set, skipping file upload
fi
echo $cmdname complete
echo executing given command $@
exec "$@"