Skip to content

Commit f6c0d26

Browse files
committed
Fix failing multi-arch builds and pick up upstream reliability fixes
build.yaml: drop tags from the per-platform push step (they conflict with push-by-digest=true,push=true and cause all master-branch matrix jobs to fail on GHCR). The merge job already creates the :build and :<version>-build tags via buildx imagetools create. Also drop linux/arm/v7 from the matrix: proton-bridge's CGO deps (libfido2/cbor) don't cross-compile cleanly on 32-bit ARM and upstream doesn't target it. build/Dockerfile: add runtime libfido2-1 and libcbor0.10 (dynamically linked by the built binaries, previously missing), add pkg-config to the build stage (CGO needs it to find .pc files), add procps for the healthcheck, and add a HEALTHCHECK so orchestrators detect a crashed bridge. Pulled from shenxn#149, shenxn#134, shenxn#128. build/entrypoint.sh, deb/entrypoint.sh: remove stale /root/.gnupg/ S.gpg-agent* sockets on startup (fixes bridge failing to start after a container restart) and harden socat with fork,reuseaddr and nodelay for more reliable port forwarding. Pulled from shenxn#134. README.md: drop arm/v7 from the supported platforms list.
1 parent f81fc8a commit f6c0d26

5 files changed

Lines changed: 23 additions & 12 deletions

File tree

.github/workflows/build.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
env:
1616
GHCR_REPO: ghcr.io/illusorykitsune/protonmail-bridge-docker
17-
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
17+
PLATFORMS: linux/amd64,linux/arm64/v8,linux/riscv64
1818

1919
jobs:
2020
test:
@@ -89,7 +89,6 @@ jobs:
8989
platform:
9090
- linux/amd64
9191
- linux/arm64/v8
92-
- linux/arm/v7
9392
- linux/riscv64
9493
steps:
9594
- name: Checkout
@@ -133,9 +132,6 @@ jobs:
133132
outputs: type=image,"name=${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=true
134133
context: ./build
135134
file: ./build/Dockerfile
136-
tags: |
137-
"${{ env.GHCR_REPO }}:build"
138-
"${{ env.GHCR_REPO }}:${{ env.version }}-build"
139135
provenance: false
140136
sbom: false
141137
build-args: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ghcr.io/illusorykitsune/protonmail-bridge-docker
1313
Two image types are produced:
1414

1515
- `deb` — based on the official [.deb release](https://proton.me/mail/bridge). `amd64` only.
16-
- `build` — built from [Proton Bridge source](https://github.com/ProtonMail/proton-bridge). Supports `amd64`, `arm64`, `arm/v7`, and `riscv64`.
16+
- `build` — built from [Proton Bridge source](https://github.com/ProtonMail/proton-bridge). Supports `amd64`, `arm64`, and `riscv64`.
1717

1818
| tag | description |
1919
| ------------------ | ----------------------------------- |

build/Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM debian:sid-slim AS build
44
ARG version
55

66
# Install dependencies
7-
RUN apt-get update && apt-get install -y golang build-essential libsecret-1-dev libfido2-dev libcbor-dev libssl-dev
7+
RUN apt-get update && apt-get install -y golang build-essential pkg-config libsecret-1-dev libfido2-dev libcbor-dev libssl-dev
88

99
# Build
1010
ADD https://github.com/ProtonMail/proton-bridge.git#${version} /build/
@@ -17,9 +17,12 @@ LABEL maintainer="Simon Felding <sife@adm.ku.dk>"
1717
EXPOSE 25/tcp
1818
EXPOSE 143/tcp
1919

20+
HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=60s \
21+
CMD pgrep -f proton-bridge >/dev/null || exit 1
22+
2023
# Install dependencies and protonmail bridge
2124
RUN apt-get update \
22-
&& apt-get install -y --no-install-recommends socat pass libsecret-1-0 ca-certificates \
25+
&& apt-get install -y --no-install-recommends socat pass libsecret-1-0 libfido2-1 libcbor0.10 ca-certificates procps \
2326
&& rm -rf /var/lib/apt/lists/*
2427

2528
# Copy bash scripts

build/entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ if [[ $1 == init ]]; then
2020

2121
else
2222

23+
# Remove stale gpg-agent sockets left over from an unclean shutdown,
24+
# otherwise the bridge fails to start after a container restart.
25+
if [ -d /root/.gnupg ]; then
26+
rm -f /root/.gnupg/S.gpg-agent*
27+
fi
28+
2329
# socat will make the conn appear to come from 127.0.0.1
2430
# ProtonMail Bridge currently expects that.
2531
# It also allows us to bind to the real ports :)
26-
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
27-
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
32+
socat TCP-LISTEN:25,fork,reuseaddr TCP:127.0.0.1:1025,nodelay &
33+
socat TCP-LISTEN:143,fork,reuseaddr TCP:127.0.0.1:1143,nodelay &
2834

2935
# Start protonmail
3036
# Fake a terminal, so it does not quit because of EOF...

deb/entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ if [[ $1 == init ]]; then
3434

3535
else
3636

37+
# Remove stale gpg-agent sockets left over from an unclean shutdown,
38+
# otherwise the bridge fails to start after a container restart.
39+
if [ -d /root/.gnupg ]; then
40+
rm -f /root/.gnupg/S.gpg-agent*
41+
fi
42+
3743
# socat will make the conn appear to come from 127.0.0.1
3844
# ProtonMail Bridge currently expects that.
3945
# It also allows us to bind to the real ports :)
40-
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
41-
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
46+
socat TCP-LISTEN:25,fork,reuseaddr TCP:127.0.0.1:1025,nodelay &
47+
socat TCP-LISTEN:143,fork,reuseaddr TCP:127.0.0.1:1143,nodelay &
4248

4349
# Start protonmail
4450
# Fake a terminal, so it does not quit because of EOF...

0 commit comments

Comments
 (0)