Skip to content

Commit f74b89a

Browse files
committed
Merge branch 'trs/non-root-user-trois'
2 parents 5a5cdca + 30a0fcf commit f74b89a

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
145145
less \
146146
perl \
147147
ruby \
148+
util-linux \
148149
wget \
149150
xz-utils \
150151
zip unzip \
@@ -266,6 +267,7 @@ RUN useradd nextstrain \
266267

267268
# The host should bind mount the pathogen build dir into /nextstrain/build.
268269
WORKDIR /nextstrain/build
270+
RUN chown nextstrain:nextstrain /nextstrain/build
269271

270272
ENTRYPOINT ["/sbin/entrypoint"]
271273

entrypoint

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ if [[ $# -eq 0 ]]; then
1717
the source of the \`nextstrain\` command for examples.
1818
"
1919
else
20-
# Otherwise, exec into whatever command is provided.
21-
exec "$@"
20+
# Otherwise, exec into whatever command is provided…
21+
if [[ "$(id -u):$(id -g)" == 0:0 ]]; then
22+
# …switching to nextstrain:nextstrain first if we're root.
23+
exec setpriv --reuid nextstrain --regid nextstrain --init-groups "$@"
24+
else
25+
exec "$@"
26+
fi
2227
fi

0 commit comments

Comments
 (0)