run as non-root in docker

This commit is contained in:
Thibault Godouet
2021-07-25 17:42:10 +01:00
parent cc26ba05b3
commit 07d1004e09
3 changed files with 15 additions and 3 deletions

View File

@@ -25,4 +25,11 @@ COPY gpgparams entrypoint.sh /protonmail/
# Copy protonmail
COPY --from=build /build/proton-bridge/proton-bridge /protonmail/
# Add a user 'protonmail' with UID 8535
RUN useradd -u 8535 -d /home/protonmail protonmail \
&& mkdir -p /home/protonmail \
&& chown protonmail: /home/protonmail
# change to non-privileged user for extra security
USER protonmail
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]

View File

@@ -2,6 +2,11 @@
set -ex
id
# Go to current user's homedir
cd
echo $PWD
# Initialize
if [[ $1 == init ]]; then