protonmail-bridge/entrypoint

21 lines
No EOL
610 B
Bash
Executable file

#!/bin/bash
# Add local user
# Either use the PUID/PGID if passed in at runtime or
# fallback
USER_ID=${PUID:-9001}
GROUP_ID=${PGID:-$USER_ID}
echo "Starting with UID : $USER_ID:$GROUP_ID"
addgroup -g $GROUP_ID proton
adduser -D -u $USER_ID -G proton -h /var/lib/proton -s /bin/bash proton
chown -R ${USER_ID}:${GROUP_ID} /var/lib/proton
export HOME=/var/lib/proton
# socat will make the conn appear to come from 127.0.0.1
# ProtonMail Bridge currently expects that.
socat TCP-LISTEN:$SMTP_PORT,fork TCP:127.0.0.1:1025 &
socat TCP-LISTEN:$IMAP_PORT,fork TCP:127.0.0.1:1143 &
exec /sbin/su-exec proton "$@"