From a0e993c0cc5a71d26dea5e9a6c811cacf4022d6e Mon Sep 17 00:00:00 2001 From: d3vnu1l Date: Fri, 3 Jan 2025 16:47:52 -0800 Subject: [PATCH] fixes --- build/Dockerfile | 21 ++++++++++----------- build/VERSION | 2 +- build/build.sh | 6 ++---- build/entrypoint.sh | 16 ++++++++++------ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 1971c40..d1096ff 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,29 +1,28 @@ -# Use carlosedp/golang for riscv64 support -FROM carlosedp/golang:1.18 AS build +FROM golang:1.23 AS build -# Install dependencies -RUN apt-get update && apt-get install -y git build-essential libsecret-1-dev +# Install build dependencies +RUN apt-get update \ + && apt-get install -y --no-install-recommends git build-essential libsecret-1-dev # Build WORKDIR /build/ COPY build.sh VERSION /build/ RUN bash build.sh -FROM ubuntu:jammy -LABEL maintainer="Xiaonan Shen " +FROM debian:bookworm +LABEL maintainer="Ryan Deushane " -EXPOSE 25/tcp -EXPOSE 143/tcp +EXPOSE 25/tcp 143/tcp -# Install dependencies and protonmail bridge +# Install dependencies RUN apt-get update \ - && apt-get install -y --no-install-recommends socat pass libsecret-1-0 ca-certificates \ + && apt-get install -y --no-install-recommends socat pass procps libsecret-1-0 ca-certificates \ && rm -rf /var/lib/apt/lists/* # Copy bash scripts COPY gpgparams entrypoint.sh /protonmail/ -# Copy protonmail +# Install protonmail COPY --from=build /build/proton-bridge/bridge /protonmail/ COPY --from=build /build/proton-bridge/proton-bridge /protonmail/ diff --git a/build/VERSION b/build/VERSION index 7ccd8d4..d0adf2c 100644 --- a/build/VERSION +++ b/build/VERSION @@ -1 +1 @@ -3.16.0 \ No newline at end of file +3.15.1 \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index 91f2772..f8173ad 100644 --- a/build/build.sh +++ b/build/build.sh @@ -1,13 +1,11 @@ #!/bin/bash - -set -ex +set -eoux pipefail VERSION=`cat VERSION` # Clone new code -git clone https://github.com/ProtonMail/proton-bridge.git +git clone https://github.com/ProtonMail/proton-bridge.git --depth 1 --branch v$VERSION cd proton-bridge -git checkout v$VERSION ARCH=$(uname -m) if [[ $ARCH == "armv7l" ]] ; then diff --git a/build/entrypoint.sh b/build/entrypoint.sh index 1931087..0402999 100644 --- a/build/entrypoint.sh +++ b/build/entrypoint.sh @@ -1,10 +1,8 @@ #!/bin/bash - -set -ex +set -eoux pipefail # Initialize -if [[ $1 == init ]]; then - +if [[ "${1:-}" == "init" ]]; then # Initialize pass gpg --generate-key --batch /protonmail/gpgparams pass init pass-key @@ -17,9 +15,16 @@ if [[ $1 == init ]]; then # Login /protonmail/proton-bridge --cli $@ +elif [[ "${1:-}" == "cli" ]]; 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 protonmail-bridge || true + # Login + /protonmail/proton-bridge --cli $@ else - # socat will make the conn appear to come from 127.0.0.1 # ProtonMail Bridge currently expects that. # It also allows us to bind to the real ports :) @@ -31,5 +36,4 @@ else rm -f faketty mkfifo faketty cat faketty | /protonmail/proton-bridge --cli $@ - fi