Skip to content

Commit

Permalink
feat: Rootless container
Browse files Browse the repository at this point in the history
Closes: #16
  • Loading branch information
ghusta committed Aug 29, 2024
1 parent 32765da commit 3da2860
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ RUN set -ex; \
wget -q https://github.com/ghusta/FakeSMTP/releases/download/v${APP_VERSION}/fakeSMTP-${APP_VERSION}.jar -O fakeSMTP.jar; \
mv fakeSMTP.jar /opt;

# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN useradd --no-log-init --system --uid ${UID} fakesmtp \
&& usermod --append --groups mail fakesmtp
# User fakesmtp is added to system group mail to be able to write to /var/mail/
# See permissions : ls -ld /var/mail
USER fakesmtp

EXPOSE 25
VOLUME ["/var/mail"]

Expand Down

0 comments on commit 3da2860

Please sign in to comment.