From 18040d4b41c792ec896fe2f32addcd597c4e8a31 Mon Sep 17 00:00:00 2001 From: Simon Ungar Felding Date: Wed, 11 Dec 2024 12:27:43 +0100 Subject: [PATCH] add env variables! --- build/Dockerfile | 7 +++++-- build/entrypoint.sh | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 7bbb37a..d2b0200 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -8,7 +8,7 @@ WORKDIR /build/ COPY build.sh VERSION /build/ RUN bash build.sh -FROM debian:sid +FROM debian:sid-slim LABEL maintainer="Xiaonan Shen " # These are only exported if running as root @@ -18,9 +18,12 @@ EXPOSE 143/tcp EXPOSE 2025/tcp EXPOSE 2143/tcp +ENV PROTONMAIL_TelemetryDisabled=false +ENV PROTONMAIL_AutoUpdate=false + # Install dependencies and protonmail bridge RUN apt-get update \ - && apt-get install -y --no-install-recommends procps socat pass libsecret-1-0 ca-certificates \ + && apt-get install -y --no-install-recommends procps jq socat pass libsecret-1-0 ca-certificates \ && rm -rf /var/lib/apt/lists/* # Copy bash scripts diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 74a3504..5392ec7 100644 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -54,6 +54,18 @@ else socat TCP-LISTEN:2025,fork TCP:127.0.0.1:1025 & socat TCP-LISTEN:2143,fork TCP:127.0.0.1:1143 & + # check if the vault-editor can read the config + /protonmail/vault-editor read 2>&1 1>/dev/null + # Modify the protonmail config with env variables and expected values + /protonmail/vault-editor read | \ + jq '.Settings.AutoUpdate = env.PROTONMAIL_AutoUpdate + | .Settings.TelemetryDisabled = env.PROTONMAIL_TelemetryDisabled + | .Settings.GluonDir |= "\(env.HOME)/.local/share/protonmail/bridge-v3/gluon" + | .Settings.Autostart = false + | .Settings.SMTPPort = 1025 + | .Settings.IMAPPort = 1143 ' \ + | /protonmail/vault-editor write + # Start protonmail /protonmail/proton-bridge --noninteractive $@