forked from nextstrain/docker-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint
executable file
·27 lines (24 loc) · 1.09 KB
/
entrypoint
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
#!/bin/bash
set -euo pipefail
if [[ $# -eq 0 ]]; then
# If the container is run with no arguments, then print a message and exit.
cut -c 9- <<<"
This is the Nextstrain pathogen build container. It has a complete
Nextstrain environment installed which is normally accessed via the
\`nextstrain\` command on your computer (not in the container).
If you're seeing this message though, you're probably not using the
\`nextstrain\` command. Welcome! :-)
The default container entrypoint will exec a command-line of your
choosing in the build environment. You can use this functionality to
debug or develop Nextstrain pathogen builds and components. Refer to
the source of the \`nextstrain\` command for examples.
"
else
# Otherwise, exec into whatever command is provided…
if [[ "$(id -u):$(id -g)" == 0:0 ]]; then
# …switching to nextstrain:nextstrain first if we're root.
exec setpriv --reuid nextstrain --regid nextstrain --init-groups "$@"
else
exec "$@"
fi
fi