Initial Commit
Some checks failed
andreas-personal/protonmail-bridge-docker/pipeline/head There was a failure building this commit

This commit is contained in:
Andreas Fahrecker 2024-03-16 01:42:57 +01:00
commit a86785411a
6 changed files with 154 additions and 0 deletions

14
Dockerfile Normal file
View File

@ -0,0 +1,14 @@
FROM debian:buster
WORKDIR /opt/protonmail
# Copy bash scripts
COPY gpgparams install.sh entrypoint.sh VERSION /protonmail/
# Install dependencies and protonmail bridge
RUN bash install.sh
ENTRYPOINT ["bash", "/opt/protonmail/entrypoint.sh"]
EXPOSE 25/tcp
EXPOSE 143/tcp

46
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,46 @@
#!groovy
pipeline {
agent none
stages {
stage('Build/Push Docker Image') {
when {
beforeAgent true;
branch 'main'
}
agent {
label 'linux'
}
environment {
DOCKER_HUB_CREDENTIALS = credentials('docker-hub-fah16145')
}
stages {
stage('Login') {
steps {
sh 'docker login -u ${DOCKER_HUB_CREDENTIALS_USR} -p ${DOCKER_HUB_CREDENTIALS_PSW}'
}
}
stage('Default Image') {
stages {
stage('Build') {
steps {
sh 'docker build -t fah16145/protonmail-bridge:latest .'
}
}
stage('Push') {
steps {
sh 'docker push fah16145/protonmail-bridge:latest'
}
}
}
}
}
post {
always {
sh 'docker logout'
}
}
}
}
}

1
VERSION Normal file
View File

@ -0,0 +1 @@
3.9.1-1

49
entrypoint.sh Normal file
View File

@ -0,0 +1,49 @@
#!/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

8
gpgparams Normal file
View File

@ -0,0 +1,8 @@
%no-protection
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 2048
Name-Real: pass-key
Expire-Date: 0
%commit
%echo done

36
install.sh Normal file
View File

@ -0,0 +1,36 @@
#!/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