Files
protonmail-bridge/entrypoint.sh
T
GitHub Actions 8bf274ff69
Build and Push Docker Container / build-and-push (push) Successful in 7m1s
fix: force patched nogui bridge binary to bind on 0.0.0.0
- Install patched nogui bridge as both /usr/bin/bridge and /usr/bin/proton-bridge

- Give copied binaries explicit target names for clarity

- Remove persisted auto-update dir so upstream 127.0.0.1 binary is not used

- Run bridge from /usr/bin via new BRIDGE_BIN variable

- Kill both bridge and proton-bridge process names on init

Prevents Proton auto-updates from reverting IMAP/SMTP to loopback-only.
2026-07-01 16:38:10 +02:00

47 lines
1.3 KiB
Bash

#!/bin/sh
set -e
mkdir -p /root/.gnupg
chmod 700 /root/.gnupg
# Initialize pass store if missing
if [ ! -d "/root/.password-store" ]; then
echo "Initializing password store..."
# Generate GPG key
gpg --batch --gen-key /protonmail/gpgparams
# Extract fingerprint
KEY=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec:/ {print $5; exit}')
# Initialize pass
pass init "$KEY"
fi
# Avoid launching Proton's auto-updated upstream binary from the persisted
# /root volume. Those official binaries bind IMAP/SMTP to 127.0.0.1. This image
# deliberately runs the patched nogui binary from /usr/bin, built with host
# constant 0.0.0.0.
rm -rf /root/.local/share/protonmail/bridge-v3/updates
BRIDGE_BIN=/usr/bin/bridge
# Initialize
if [[ "$1" == "init" ]]; then
# Kill the other instance as only one can be running at a time.
# This allows users to run entrypoint init inside a running conainter
# which is useful in a k8s environment.
# || true to make sure this would not fail in case there is no running instance.
pkill bridge || true
pkill proton-bridge || true
# Run any ProtonMail Bridge Command - Login
"$BRIDGE_BIN" --cli "$@"
else
# Start ProtonMail Bridge
# Fake a terminal, so it does not quit because of EOF...
rm -f faketty
mkfifo faketty
cat faketty | "$BRIDGE_BIN" --cli "$@"
fi