Skip to content

Commit 3da2860

Browse files
committed
feat: Rootless container
Closes: #16
1 parent 32765da commit 3da2860

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ RUN set -ex; \
66
wget -q https://github.com/ghusta/FakeSMTP/releases/download/v${APP_VERSION}/fakeSMTP-${APP_VERSION}.jar -O fakeSMTP.jar; \
77
mv fakeSMTP.jar /opt;
88

9+
# Create a non-privileged user that the app will run under.
10+
# See https://docs.docker.com/go/dockerfile-user-best-practices/
11+
ARG UID=10001
12+
RUN useradd --no-log-init --system --uid ${UID} fakesmtp \
13+
&& usermod --append --groups mail fakesmtp
14+
# User fakesmtp is added to system group mail to be able to write to /var/mail/
15+
# See permissions : ls -ld /var/mail
16+
USER fakesmtp
17+
918
EXPOSE 25
1019
VOLUME ["/var/mail"]
1120

0 commit comments

Comments
 (0)