Change docker user and some minor improvements

This commit is contained in:
Xiaonan Shen
2022-05-28 17:28:20 +08:00
parent c38ac6fbb5
commit 1c64b99201
6 changed files with 125 additions and 52 deletions

41
entrypoint.sh Normal file → Executable file
View File

@@ -2,36 +2,15 @@
set -e
# Generate gpg keys
if [ ! -f ${HOME}/.gnupg ]; then
echo "Generateing gpg keys..."
# set GNUPGHOME as a workaround for
#
# gpg-agent[106]: error binding socket to '/root/.gnupg/S.gpg-agent': File name too long
#
# when using docker volume mount
#
# ref: https://dev.gnupg.org/T2964
#
export GNUPGHOME=/tmp/gnupg
mkdir ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
gpg --generate-key --batch /srv/protonmail/gpgparams
pkill gpg-agent
mv ${GNUPGHOME} ${HOME}/.gnupg
export GNUPGHOME=""
fi
echo "Welcome to ProtonMail Bridge Docker 2.0. This version comes with plently of"
echo "improvements. This version is not compatible with old configs and data volumes."
echo "If you are coming from the old version, please clean up your volumes and set up"
echo "everything from scratch. For more information about the new version, check"
echo "https://github.com/shenxn/protonmail-bridge-docker"
echo
# Initialize pass
if [ ! -f ${HOME}/.password-store/.gpg-id ]; then
echo "Initializing pass"
pass init pass-key
fi
groupadd -g ${PROTON_GID:-1001} proton
useradd -g proton -u ${PROTON_UID:-1001} -m proton
chown proton:proton -R /protonmail/data
# socat will make the conn appear to come from 127.0.0.1
# ProtonMail Bridge currently expects that.
# It also allows us to bind to the real ports :)
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
/srv/protonmail/proton-bridge --cli $@
exec gosu proton:proton run_protonmail_bridge.sh "$@"