Compare commits
51 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6db0b9271c | |||
| 9d5ead578d | |||
| 862d2bf49a | |||
| 49f5f6be59 | |||
| 26a1c6226c | |||
| b32608abb3 | |||
| ec399a94ec | |||
| 219771ec52 | |||
| bb980519e4 | |||
| 3c3e3e7727 | |||
| c575b8f86f | |||
| 7f55378a4d | |||
| ed65643608 | |||
| ebd10ab5b8 | |||
| c192a4fbf3 | |||
| 596ecffb83 | |||
| 26b7e5c3ff | |||
| 4600e81d6b | |||
| efd9a9cb96 | |||
| d3aee1a6db | |||
| 2d3885fede | |||
| 633f7e77ae | |||
| bd98d7c0e0 | |||
| fbeb4edbd8 | |||
| 7f84bf5de2 | |||
| 7962016a4b | |||
|
|
be25850914 | ||
|
|
0e5464f5ee | ||
|
|
bd3b7d6451 | ||
|
|
4409953211 | ||
|
|
bdd5988498 | ||
|
|
139b6744cb | ||
|
|
8e22ce7e9f | ||
|
|
457f5e86cb | ||
|
|
bd2554e463 | ||
|
|
f046d78430 | ||
|
|
ea7f123e2c | ||
|
|
d5845951b1 | ||
|
|
feab405f18 | ||
|
|
bd56e77823 | ||
|
|
1672fda080 | ||
|
|
cfe1bf4e9b | ||
|
|
161f5cbbf2 | ||
|
|
254b916aa6 | ||
|
|
8758d46621 | ||
|
|
52d152b8c2 | ||
|
|
d4f4a0a98e | ||
|
|
c812a8aed7 | ||
|
|
b52a231c3c | ||
|
|
30c93de13e | ||
|
|
f3e41a2856 |
4 changed files with 103 additions and 45 deletions
65
.drone.yml
65
.drone.yml
|
|
@ -1,27 +1,58 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
type: exec
|
||||
name: default
|
||||
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
environment:
|
||||
DOCKER_CLI_EXPERIMENTAL: enabled
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: alexviscreanu/buildx
|
||||
commands:
|
||||
- docker run --rm --privileged docker/binfmt:a7996909642ee92942dcd6cff44b9b95f08dad64
|
||||
- export BUILDER_ID="crosscomp-$(cat /proc/self/cgroup | head -1 | cut -d '/' -f 3)"
|
||||
- docker buildx create --use --name $BUILDER_ID --driver-opt image=stargate01/buildkit
|
||||
- docker buildx inspect --bootstrap
|
||||
- echo $REGISTRY_PASS | docker login --username $REGISTRY_USER --password-stdin $REGISTRY_HOST
|
||||
- docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --output=type=image,push=true --progress tty --build-arg TAG=$DRONE_TAG -t $REGISTRY_HOST/$IMAGE:$DRONE_TAG -t $REGISTRY_HOST/$IMAGE:latest .
|
||||
- docker buildx rm $BUILDER_ID
|
||||
volumes:
|
||||
- name: docker_socket
|
||||
path: /var/run/docker.sock
|
||||
- |-
|
||||
case $(uname -a) in
|
||||
*x86_64*)
|
||||
export ARCH="amd64"
|
||||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
||||
;;
|
||||
*aarch64*)
|
||||
export ARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
export ARCH="unknown"
|
||||
;;
|
||||
esac
|
||||
- |-
|
||||
export BUILDX_URL=$(\
|
||||
wget -q -O - https://api.github.com/repos/docker/buildx/releases/latest\
|
||||
| grep "browser_download_url.*linux-$ARCH"\
|
||||
| cut -d: -f2,3\
|
||||
| tr -d \"\
|
||||
| tr -d \ \
|
||||
)
|
||||
- mkdir -p ~/.docker/cli-plugins
|
||||
- wget -O ~/.docker/cli-plugins/docker-buildx $BUILDX_URL
|
||||
- chmod a+x ~/.docker/cli-plugins/docker-buildx
|
||||
- docker version
|
||||
- docker buildx version
|
||||
- |-
|
||||
echo -n $REGISTRY_PASS\
|
||||
| docker login -u $REGISTRY_USER --password-stdin $REGISTRY_HOST
|
||||
- docker buildx create --name multiarch --use
|
||||
- |-
|
||||
docker buildx build\
|
||||
--no-cache\
|
||||
--platform linux/amd64,linux/arm64\
|
||||
--output type=image,push=true\
|
||||
--progress tty\
|
||||
--build-arg TAG=$DRONE_TAG\
|
||||
-t $REGISTRY_HOST/$IMAGE:$DRONE_TAG\
|
||||
-t $REGISTRY_HOST/$IMAGE:latest\
|
||||
.
|
||||
environment:
|
||||
IMAGE: protonmail-bridge
|
||||
REGISTRY_HOST: registry.thegibsonhome.net
|
||||
|
|
@ -32,4 +63,4 @@ steps:
|
|||
|
||||
trigger:
|
||||
event:
|
||||
- tag
|
||||
- tag
|
||||
|
|
|
|||
59
Dockerfile
59
Dockerfile
|
|
@ -1,36 +1,55 @@
|
|||
# Build the ProtonMail Bridge.
|
||||
FROM golang:1.14-alpine as build
|
||||
FROM golang:1.18-buster as build
|
||||
ENV LANG C.UTF-8
|
||||
RUN apk add --no-cache \
|
||||
gcc \
|
||||
git \
|
||||
libsecret-dev \
|
||||
make \
|
||||
musl-dev
|
||||
WORKDIR /usr/src
|
||||
|
||||
# Install required build packages
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y \
|
||||
bash \
|
||||
build-essential \
|
||||
curl \
|
||||
git \
|
||||
libsecret-1-dev \
|
||||
musl-dev
|
||||
|
||||
# Download/build the application
|
||||
WORKDIR /usr/src
|
||||
ARG RELEASE
|
||||
ARG TAG
|
||||
RUN git clone https://github.com/ProtonMail/proton-bridge.git proton-bridge \
|
||||
&& cd proton-bridge \
|
||||
&& if [ -n "$TAG" ]; then echo "Using tags/$TAG..."; git checkout tags/$TAG; fi \
|
||||
&& make build-nogui
|
||||
RUN if [ -n "$RELEASE" ]; then \
|
||||
echo "Using release $RELEASE..." \
|
||||
&& curl -L -s "https://github.com/ProtonMail/proton-bridge/archive/$RELEASE.tar.gz" | tar zx \
|
||||
&& export PROTON_BRIDGE="proton-bridge-$(echo $RELEASE | sed -e 's/^\(v\|br\)//')" \
|
||||
&& ln -s "${PROTON_BRIDGE}" proton-bridge \
|
||||
&& cd "${PROTON_BRIDGE}" \
|
||||
; else \
|
||||
git clone https://github.com/ProtonMail/proton-bridge.git proton-bridge \
|
||||
&& cd proton-bridge \
|
||||
&& if [ -n "$TAG" ]; then echo "Using tags/$TAG..."; git checkout tags/$TAG; fi \
|
||||
; fi \
|
||||
&& make build-nogui
|
||||
|
||||
# Create a container for the ProtonMail Bridge.
|
||||
FROM alpine:edge
|
||||
FROM debian:stable
|
||||
ENV LANG C.UTF-8
|
||||
|
||||
EXPOSE 25/tcp
|
||||
EXPOSE 143/tcp
|
||||
|
||||
COPY --from=build /usr/src/proton-bridge/Desktop-Bridge /bin/protonmail-bridge
|
||||
COPY --from=build /usr/src/proton-bridge/proton-bridge /bin/proton-bridge
|
||||
COPY --from=build /usr/src/proton-bridge/bridge /bin/bridge
|
||||
COPY entrypoint /bin/
|
||||
COPY initproton /bin/
|
||||
RUN apk add --no-cache \
|
||||
libsecret \
|
||||
pass \
|
||||
socat \
|
||||
su-exec \
|
||||
&& chmod +x /bin/entrypoint \
|
||||
RUN apt-get update\
|
||||
&& apt-get install -y --no-install-recommends --no-install-suggests\
|
||||
libcap2\
|
||||
libsecret-1-0\
|
||||
gosu\
|
||||
gpg-agent\
|
||||
pass\
|
||||
socat\
|
||||
&& rm -rf /var/lib/apt/lists/*\
|
||||
&& chmod +x /bin/entrypoint\
|
||||
&& chmod +x /bin/initproton
|
||||
|
||||
WORKDIR /var/lib/proton
|
||||
|
|
|
|||
|
|
@ -9,13 +9,11 @@ GROUP=proton
|
|||
if getent group $GROUP_ID > /dev/null; then
|
||||
echo "Using group $GROUP with GID $GROUP_ID..."
|
||||
GROUP=$(getent group $GROUP_ID | cut -d: -f1)
|
||||
echo "Using group $GROUP with GID $GROUP_ID..."
|
||||
else
|
||||
echo "Adding group $GROUP with GID $GROUP_ID..."
|
||||
addgroup -g $GROUP_ID $GROUP
|
||||
fi
|
||||
echo "Adding user proton with group $GROUP..."
|
||||
echo adduser -D -u $USER_ID -G $GROUP -h /var/lib/proton -s /bin/sh proton
|
||||
echo "Adding user proton ($USER_ID) with group $GROUP ${GROUP_ID}..."
|
||||
adduser -D -u $USER_ID -G $GROUP -h /var/lib/proton -s /bin/sh proton
|
||||
chown -R ${USER_ID}:${GROUP_ID} /var/lib/proton
|
||||
export HOME=/var/lib/proton
|
||||
|
|
@ -27,4 +25,5 @@ setcap 'cap_net_bind_service=+ep' /usr/bin/socat
|
|||
socat TCP-LISTEN:25,fork TCP:127.0.0.1:1025 &
|
||||
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
|
||||
|
||||
exec /sbin/su-exec proton "$@"
|
||||
echo "Starting ProtonMail Bridge..."
|
||||
exec /usr/sbin/gosu proton "$@"
|
||||
|
|
|
|||
11
initproton
11
initproton
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -eufo pipefail
|
||||
|
||||
BRIDGE=/bin/protonmail-bridge
|
||||
BRIDGE=/bin/bridge
|
||||
FIFO=/tmp/fifo
|
||||
PRINT_INFO=${PRINT_INFO:-""}
|
||||
|
||||
|
|
@ -11,14 +11,20 @@ if [ -n "$PASS_FILE" ]; then
|
|||
PASS=$(cat $PASS_FILE)
|
||||
fi
|
||||
|
||||
echo "Checking for GPG configuration..."
|
||||
if ! [ -d .gnupg ]; then
|
||||
echo "Generating GPG Key..."
|
||||
echo -e "%no-protection\nKey-Type: RSA\nKey-Length: 4096\nName-Real: $EMAIL\nExpire-Date: 0\n%commit" \
|
||||
| gpg --generate-key --batch
|
||||
fi
|
||||
echo "Checking for Password Store..."
|
||||
if ! [ -d .password-store ]; then
|
||||
echo "Initializing Pass..."
|
||||
pass init "$EMAIL"
|
||||
fi
|
||||
echo "Checking for ProtonMail Bridge Cache..."
|
||||
if ! [ -d ~/.cache/protonmail/bridge ]; then
|
||||
echo "Logging in to ProtonMail Bridge..."
|
||||
COMMAND="login\n$EMAIL\n$PASSWORD"
|
||||
MFA_CODE=${MFA_CODE:-}
|
||||
if [ -n "$MFA_CODE" ]; then
|
||||
|
|
@ -28,6 +34,7 @@ if ! [ -d ~/.cache/protonmail/bridge ]; then
|
|||
fi
|
||||
|
||||
if [ -n "$PRINT_INFO" ]; then
|
||||
echo "Printing Info..."
|
||||
echo info | $BRIDGE --cli | egrep '(Username|Password)' | sort -ru
|
||||
fi
|
||||
|
||||
|
|
@ -37,4 +44,6 @@ if [ -n "$LOG_LEVEL" ]; then
|
|||
ARGUMENTS="${ARGUMENTS} --log-level ${LOG_LEVEL}"
|
||||
fi
|
||||
|
||||
echo "Starting ProtonMail Bridge: $BRIDGE $ARGUMENTS"
|
||||
$BRIDGE --version
|
||||
$BRIDGE $ARGUMENTS
|
||||
Loading…
Add table
Add a link
Reference in a new issue