Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
85 lines (73 loc) · 2.67 KB
/
Copy pathDockerfile
File metadata and controls
85 lines (73 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
FROM --platform=$TARGETPLATFORM golang:1.26-trixie AS build
LABEL authors="David BASTIEN"
ARG ENV_PROTONMAIL_BRIDGE_VERSION
ARG TARGETPLATFORM
ARG BUILDPLATFORM
# Install dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y git build-essential libfido2-dev libsecret-1-dev libcbor-dev
# Build stage
WORKDIR /build/
RUN set -eux; \
git clone -b $ENV_PROTONMAIL_BRIDGE_VERSION https://github.com/ProtonMail/proton-bridge.git
WORKDIR /build/proton-bridge/
RUN set -eux; \
make build-nogui vault-editor
# Working stage image
FROM --platform=$TARGETPLATFORM debian:trixie-slim
LABEL authors="David BASTIEN"
LABEL org.opencontainers.image.source="https://github.com/VideoCurio/ProtonMailBridgeDocker"
LABEL org.opencontainers.image.description="A docker version of the Proton Mail Bridge command line interface, providing local SMTP/IMAP servers for Proton Mail accounts."
LABEL org.opencontainers.image.title="Proton Mail Bridge Docker"
LABEL org.opencontainers.image.licenses="GPL-3.0-or-later"
# Define arguments and env variables
ARG TARGETPLATFORM
# Indicate (NOT define) the ports/network interface really used by Proton bridge mail.
ARG ENV_BRIDGE_SMTP_PORT=1025
ARG ENV_BRIDGE_IMAP_PORT=1143
ARG ENV_BRIDGE_HOST=127.0.0.1
# Change ENV_CONTAINER_SMTP_PORT only if you have a docker port conflict on host network namespace.
ARG ENV_CONTAINER_SMTP_PORT=25
ARG ENV_CONTAINER_IMAP_PORT=143
ENV PROTON_BRIDGE_SMTP_PORT=$ENV_BRIDGE_SMTP_PORT
ENV PROTON_BRIDGE_IMAP_PORT=$ENV_BRIDGE_IMAP_PORT
ENV PROTON_BRIDGE_HOST=$ENV_BRIDGE_HOST
ENV CONTAINER_SMTP_PORT=$ENV_CONTAINER_SMTP_PORT
ENV CONTAINER_IMAP_PORT=$ENV_CONTAINER_IMAP_PORT
ENV ENV_TARGET_PLATFORM=$TARGETPLATFORM
# Install dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
bash \
socat \
net-tools \
procps \
pass \
ca-certificates \
libsecret-1-0 \
libfido2-1 \
gnupg \
tini \
; \
rm -rf /var/lib/apt/lists/*
# Copy executables made during previous stage
WORKDIR /usr/bin/
COPY --from=build /build/proton-bridge/bridge /usr/bin/
COPY --from=build /build/proton-bridge/proton-bridge /usr/bin/
COPY --from=build /build/proton-bridge/vault-editor /usr/bin/
# Install needed scripts and files
WORKDIR /app/
COPY VERSION /app/
COPY entrypoint.sh /app/
RUN chmod u+x /app/entrypoint.sh
COPY GPGparams.txt /app/
COPY LICENSE.txt /app/
# Volume to save pass and bridge configurations/data
VOLUME /root
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD netstat -ltn | grep -q ":$CONTAINER_SMTP_PORT " && \
netstat -ltn | grep -q ":$CONTAINER_IMAP_PORT " || exit 1
ENTRYPOINT ["/usr/bin/tini", "--", "/app/entrypoint.sh"]