diff --git a/build/.dockerignore b/build/.dockerignore deleted file mode 100644 index a9d46dd..0000000 --- a/build/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -* - -!.dockerignore -!VERSION -!entrypoint.sh -!gpgparams -!Dockerfile -!build.sh -!login.exp diff --git a/build/VERSION b/build/VERSION deleted file mode 100644 index 5af131d..0000000 --- a/build/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.8.9 \ No newline at end of file diff --git a/build/build.sh b/build/build.sh deleted file mode 100644 index b12e21b..0000000 --- a/build/build.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -set -ex - -VERSION="$(cat VERSION)" - -# Clone new code -git clone https://github.com/ProtonMail/proton-bridge.git -cd proton-bridge -git checkout "v${VERSION}" - -# Build -make build-nogui diff --git a/deb/.dockerignore b/deb/.dockerignore deleted file mode 100644 index b762fe2..0000000 --- a/deb/.dockerignore +++ /dev/null @@ -1,8 +0,0 @@ -* - -!.dockerignore -!VERSION -!entrypoint.sh -!install.sh -!gpgparams -!Dockerfile diff --git a/deb/Dockerfile b/deb/Dockerfile deleted file mode 100644 index d225daf..0000000 --- a/deb/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:bionic -LABEL maintainer="Xiaonan Shen " - -EXPOSE 25/tcp -EXPOSE 143/tcp - -WORKDIR /protonmail - -# Copy bash scripts -COPY gpgparams install.sh entrypoint.sh VERSION /protonmail/ - -# Install dependencies and protonmail bridge -RUN bash install.sh - -ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"] diff --git a/deb/VERSION b/deb/VERSION deleted file mode 100644 index 26ed364..0000000 --- a/deb/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.8.7-1 \ No newline at end of file diff --git a/deb/entrypoint.sh b/deb/entrypoint.sh deleted file mode 100644 index 13637e5..0000000 --- a/deb/entrypoint.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -set -ex - -# Initialize -if [[ $1 == init ]]; then - - # # Parse parameters - # TFP="" # Default empty two factor passcode - # shift # skip `init` - # while [[ $# -gt 0 ]]; do - # key="$1" - # case $key in - # -u|--username) - # USERNAME="$2" - # ;; - # -p|--password) - # PASSWORD="$2" - # ;; - # -t|--twofactor) - # TWOFACTOR="$2" - # ;; - # esac - # shift - # shift - # done - - # Initialize pass - gpg --generate-key --batch /protonmail/gpgparams - pass init pass-key - - # Login - protonmail-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 :) - socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 & - socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 & - - # Start protonmail - # Fake a terminal, so it does not quit because of EOF... - rm -f faketty - mkfifo faketty - cat faketty | protonmail-bridge --cli - -fi diff --git a/deb/gpgparams b/deb/gpgparams deleted file mode 100644 index 355568e..0000000 --- a/deb/gpgparams +++ /dev/null @@ -1,8 +0,0 @@ -%no-protection -%echo Generating a basic OpenPGP key -Key-Type: RSA -Key-Length: 2048 -Name-Real: pass-key -Expire-Date: 0 -%commit -%echo done diff --git a/deb/install.sh b/deb/install.sh deleted file mode 100644 index dbe3eb5..0000000 --- a/deb/install.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -set -ex - -VERSION=`cat VERSION` -DEB_FILE=protonmail-bridge_${VERSION}_amd64.deb - -# Install dependents -apt-get update -apt-get install -y --no-install-recommends socat pass ca-certificates - -# Build time dependencies -apt-get install -y wget binutils xz-utils - -# Repack deb (remove unnecessary dependencies) -mkdir deb -cd deb -wget -q https://protonmail.com/download/bridge/${DEB_FILE} -ar x -v ${DEB_FILE} -mkdir control -tar zxvf control.tar.gz -C control -sed -i "s/^Depends: .*$/Depends: libgl1, libc6, libsecret-1-0, libstdc++6, libgcc1/" control/control -cd control -tar zcvf ../control.tar.gz . -cd ../ -ar rcs -v ${DEB_FILE} debian-binary control.tar.gz data.tar.gz -cd ../ - -# Install protonmail bridge -apt-get install -y --no-install-recommends ./deb/${DEB_FILE} - -# Cleanup -apt-get purge -y wget binutils xz-utils -apt-get autoremove -y -rm -rf /var/lib/apt/lists/* -rm -rf deb diff --git a/build/Dockerfile b/docker/Dockerfile similarity index 78% rename from build/Dockerfile rename to docker/Dockerfile index 77926fb..2436ff9 100644 --- a/build/Dockerfile +++ b/docker/Dockerfile @@ -5,8 +5,12 @@ RUN apt-get update && apt-get install -y libsecret-1-dev # Build WORKDIR /build/ -COPY build.sh VERSION /build/ -RUN bash build.sh +COPY VERSION /build/ + +RUN VERSION=$(cat VERSION) && \ + curl -L https://github.com/ProtonMail/proton-bridge/archive/refs/tags/${VERSION}.tar.gz \ + | tar zx --strip-component 1 && \ + make build-nogui FROM ubuntu:bionic LABEL maintainer="Xiaonan Shen " @@ -14,7 +18,7 @@ LABEL maintainer="Xiaonan Shen " EXPOSE 25/tcp EXPOSE 143/tcp -# Install dependencies and protonmail bridge +# Install dependencies RUN apt-get update \ && apt-get install -y --no-install-recommends \ expect socat pass libsecret-1-0 ca-certificates \ diff --git a/docker/VERSION b/docker/VERSION new file mode 100644 index 0000000..a1a76c0 --- /dev/null +++ b/docker/VERSION @@ -0,0 +1 @@ +v1.8.9 \ No newline at end of file diff --git a/build/entrypoint.sh b/docker/entrypoint.sh similarity index 100% rename from build/entrypoint.sh rename to docker/entrypoint.sh diff --git a/build/gpgparams b/docker/gpgparams similarity index 100% rename from build/gpgparams rename to docker/gpgparams diff --git a/build/login.exp b/docker/login.exp similarity index 100% rename from build/login.exp rename to docker/login.exp