Compare commits
19 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6db0b9271c | |||
| 9d5ead578d | |||
| 862d2bf49a | |||
| 49f5f6be59 | |||
| 26a1c6226c | |||
| b32608abb3 | |||
| ec399a94ec | |||
| 219771ec52 | |||
| bb980519e4 | |||
| 3c3e3e7727 | |||
| c575b8f86f | |||
| 7f55378a4d | |||
| ed65643608 | |||
| ebd10ab5b8 | |||
| c192a4fbf3 | |||
| 596ecffb83 | |||
| 26b7e5c3ff | |||
| 4600e81d6b | |||
| efd9a9cb96 |
4 changed files with 59 additions and 59 deletions
52
.drone.yml
52
.drone.yml
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: exec
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -10,22 +10,8 @@ platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: amd64
|
arch: amd64
|
||||||
|
|
||||||
services:
|
|
||||||
- name: dind
|
|
||||||
image: docker:dind
|
|
||||||
command: ["dockerd", "--experimental"]
|
|
||||||
privileged: true
|
|
||||||
volumes:
|
|
||||||
- name: docker_socket
|
|
||||||
path: /var/run
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: docker_socket
|
|
||||||
temp: {}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: docker:latest
|
|
||||||
commands:
|
commands:
|
||||||
- |-
|
- |-
|
||||||
case $(uname -a) in
|
case $(uname -a) in
|
||||||
|
|
@ -41,12 +27,12 @@ steps:
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
- |-
|
- |-
|
||||||
export BUILDX_URL=$( \
|
export BUILDX_URL=$(\
|
||||||
wget -q -O - \
|
wget -q -O - https://api.github.com/repos/docker/buildx/releases/latest\
|
||||||
https://api.github.com/repos/docker/buildx/releases/latest \
|
| grep "browser_download_url.*linux-$ARCH"\
|
||||||
| grep "browser_download_url.*linux-$ARCH" \
|
| cut -d: -f2,3\
|
||||||
| cut -d: -f2,3 \
|
| tr -d \"\
|
||||||
| tr -d \" \
|
| tr -d \ \
|
||||||
)
|
)
|
||||||
- mkdir -p ~/.docker/cli-plugins
|
- mkdir -p ~/.docker/cli-plugins
|
||||||
- wget -O ~/.docker/cli-plugins/docker-buildx $BUILDX_URL
|
- wget -O ~/.docker/cli-plugins/docker-buildx $BUILDX_URL
|
||||||
|
|
@ -54,23 +40,19 @@ steps:
|
||||||
- docker version
|
- docker version
|
||||||
- docker buildx version
|
- docker buildx version
|
||||||
- |-
|
- |-
|
||||||
echo -n $REGISTRY_PASS \
|
echo -n $REGISTRY_PASS\
|
||||||
| docker login -u $REGISTRY_USER --password-stdin $REGISTRY_HOST
|
| docker login -u $REGISTRY_USER --password-stdin $REGISTRY_HOST
|
||||||
- docker buildx create --name multiarch --use
|
- docker buildx create --name multiarch --use
|
||||||
- |-
|
- |-
|
||||||
docker buildx build \
|
docker buildx build\
|
||||||
--platform linux/amd64,linux/arm64 \
|
--no-cache\
|
||||||
--output=type=image,push=false \
|
--platform linux/amd64,linux/arm64\
|
||||||
--progress tty \
|
--output type=image,push=true\
|
||||||
--build-arg TAG=$DRONE_TAG \
|
--progress tty\
|
||||||
-t $REGISTRY_HOST/$IMAGE:$DRONE_TAG \
|
--build-arg TAG=$DRONE_TAG\
|
||||||
-t $REGISTRY_HOST/$IMAGE:latest \
|
-t $REGISTRY_HOST/$IMAGE:$DRONE_TAG\
|
||||||
|
-t $REGISTRY_HOST/$IMAGE:latest\
|
||||||
.
|
.
|
||||||
- docker push $REGISTRY_HOST/$IMAGE:$DRONE_TAG
|
|
||||||
- docker push $REGISTRY_HOST/$IMAGE:latest
|
|
||||||
volumes:
|
|
||||||
- name: docker_socket
|
|
||||||
path: /var/run
|
|
||||||
environment:
|
environment:
|
||||||
IMAGE: protonmail-bridge
|
IMAGE: protonmail-bridge
|
||||||
REGISTRY_HOST: registry.thegibsonhome.net
|
REGISTRY_HOST: registry.thegibsonhome.net
|
||||||
|
|
|
||||||
46
Dockerfile
46
Dockerfile
|
|
@ -1,22 +1,27 @@
|
||||||
# Build the ProtonMail Bridge.
|
# Build the ProtonMail Bridge.
|
||||||
FROM golang:1.15-alpine as build
|
FROM golang:1.18-buster as build
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
RUN apk add --no-cache \
|
|
||||||
curl \
|
|
||||||
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 RELEASE
|
||||||
ARG TAG
|
ARG TAG
|
||||||
RUN if [ -n "$RELEASE" ]; then \
|
RUN if [ -n "$RELEASE" ]; then \
|
||||||
echo "Using release $RELEASE..." \
|
echo "Using release $RELEASE..." \
|
||||||
&& curl -L -s "https://github.com/ProtonMail/proton-bridge/archive/$RELEASE.tar.gz" | tar zx \
|
&& curl -L -s "https://github.com/ProtonMail/proton-bridge/archive/$RELEASE.tar.gz" | tar zx \
|
||||||
&& ln -s "proton-bridge-$RELEASE" proton-bridge \
|
&& export PROTON_BRIDGE="proton-bridge-$(echo $RELEASE | sed -e 's/^\(v\|br\)//')" \
|
||||||
&& cd proton-bridge \
|
&& ln -s "${PROTON_BRIDGE}" proton-bridge \
|
||||||
|
&& cd "${PROTON_BRIDGE}" \
|
||||||
; else \
|
; else \
|
||||||
git clone https://github.com/ProtonMail/proton-bridge.git proton-bridge \
|
git clone https://github.com/ProtonMail/proton-bridge.git proton-bridge \
|
||||||
&& cd proton-bridge \
|
&& cd proton-bridge \
|
||||||
|
|
@ -25,21 +30,26 @@ RUN if [ -n "$RELEASE" ]; then \
|
||||||
&& make build-nogui
|
&& make build-nogui
|
||||||
|
|
||||||
# Create a container for the ProtonMail Bridge.
|
# Create a container for the ProtonMail Bridge.
|
||||||
FROM alpine:edge
|
FROM debian:stable
|
||||||
ENV LANG C.UTF-8
|
ENV LANG C.UTF-8
|
||||||
|
|
||||||
EXPOSE 25/tcp
|
EXPOSE 25/tcp
|
||||||
EXPOSE 143/tcp
|
EXPOSE 143/tcp
|
||||||
|
|
||||||
COPY --from=build /usr/src/proton-bridge/proton-bridge /bin/proton-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 entrypoint /bin/
|
||||||
COPY initproton /bin/
|
COPY initproton /bin/
|
||||||
RUN apk add --no-cache \
|
RUN apt-get update\
|
||||||
libsecret \
|
&& apt-get install -y --no-install-recommends --no-install-suggests\
|
||||||
pass \
|
libcap2\
|
||||||
socat \
|
libsecret-1-0\
|
||||||
su-exec \
|
gosu\
|
||||||
&& chmod +x /bin/entrypoint \
|
gpg-agent\
|
||||||
|
pass\
|
||||||
|
socat\
|
||||||
|
&& rm -rf /var/lib/apt/lists/*\
|
||||||
|
&& chmod +x /bin/entrypoint\
|
||||||
&& chmod +x /bin/initproton
|
&& chmod +x /bin/initproton
|
||||||
|
|
||||||
WORKDIR /var/lib/proton
|
WORKDIR /var/lib/proton
|
||||||
|
|
|
||||||
|
|
@ -9,13 +9,11 @@ GROUP=proton
|
||||||
if getent group $GROUP_ID > /dev/null; then
|
if getent group $GROUP_ID > /dev/null; then
|
||||||
echo "Using group $GROUP with GID $GROUP_ID..."
|
echo "Using group $GROUP with GID $GROUP_ID..."
|
||||||
GROUP=$(getent group $GROUP_ID | cut -d: -f1)
|
GROUP=$(getent group $GROUP_ID | cut -d: -f1)
|
||||||
echo "Using group $GROUP with GID $GROUP_ID..."
|
|
||||||
else
|
else
|
||||||
echo "Adding group $GROUP with GID $GROUP_ID..."
|
echo "Adding group $GROUP with GID $GROUP_ID..."
|
||||||
addgroup -g $GROUP_ID $GROUP
|
addgroup -g $GROUP_ID $GROUP
|
||||||
fi
|
fi
|
||||||
echo "Adding user proton with group $GROUP..."
|
echo "Adding user proton ($USER_ID) with group $GROUP ${GROUP_ID}..."
|
||||||
echo adduser -D -u $USER_ID -G $GROUP -h /var/lib/proton -s /bin/sh proton
|
|
||||||
adduser -D -u $USER_ID -G $GROUP -h /var/lib/proton -s /bin/sh proton
|
adduser -D -u $USER_ID -G $GROUP -h /var/lib/proton -s /bin/sh proton
|
||||||
chown -R ${USER_ID}:${GROUP_ID} /var/lib/proton
|
chown -R ${USER_ID}:${GROUP_ID} /var/lib/proton
|
||||||
export HOME=/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:25,fork TCP:127.0.0.1:1025 &
|
||||||
socat TCP-LISTEN:143,fork TCP:127.0.0.1:1143 &
|
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 "$@"
|
||||||
|
|
|
||||||
13
initproton
13
initproton
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eufo pipefail
|
set -eufo pipefail
|
||||||
|
|
||||||
BRIDGE=/bin/proton-bridge
|
BRIDGE=/bin/bridge
|
||||||
FIFO=/tmp/fifo
|
FIFO=/tmp/fifo
|
||||||
PRINT_INFO=${PRINT_INFO:-""}
|
PRINT_INFO=${PRINT_INFO:-""}
|
||||||
|
|
||||||
|
|
@ -11,14 +11,20 @@ if [ -n "$PASS_FILE" ]; then
|
||||||
PASS=$(cat $PASS_FILE)
|
PASS=$(cat $PASS_FILE)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Checking for GPG configuration..."
|
||||||
if ! [ -d .gnupg ]; then
|
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" \
|
echo -e "%no-protection\nKey-Type: RSA\nKey-Length: 4096\nName-Real: $EMAIL\nExpire-Date: 0\n%commit" \
|
||||||
| gpg --generate-key --batch
|
| gpg --generate-key --batch
|
||||||
fi
|
fi
|
||||||
|
echo "Checking for Password Store..."
|
||||||
if ! [ -d .password-store ]; then
|
if ! [ -d .password-store ]; then
|
||||||
|
echo "Initializing Pass..."
|
||||||
pass init "$EMAIL"
|
pass init "$EMAIL"
|
||||||
fi
|
fi
|
||||||
|
echo "Checking for ProtonMail Bridge Cache..."
|
||||||
if ! [ -d ~/.cache/protonmail/bridge ]; then
|
if ! [ -d ~/.cache/protonmail/bridge ]; then
|
||||||
|
echo "Logging in to ProtonMail Bridge..."
|
||||||
COMMAND="login\n$EMAIL\n$PASSWORD"
|
COMMAND="login\n$EMAIL\n$PASSWORD"
|
||||||
MFA_CODE=${MFA_CODE:-}
|
MFA_CODE=${MFA_CODE:-}
|
||||||
if [ -n "$MFA_CODE" ]; then
|
if [ -n "$MFA_CODE" ]; then
|
||||||
|
|
@ -28,6 +34,7 @@ if ! [ -d ~/.cache/protonmail/bridge ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$PRINT_INFO" ]; then
|
if [ -n "$PRINT_INFO" ]; then
|
||||||
|
echo "Printing Info..."
|
||||||
echo info | $BRIDGE --cli | egrep '(Username|Password)' | sort -ru
|
echo info | $BRIDGE --cli | egrep '(Username|Password)' | sort -ru
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -37,4 +44,6 @@ if [ -n "$LOG_LEVEL" ]; then
|
||||||
ARGUMENTS="${ARGUMENTS} --log-level ${LOG_LEVEL}"
|
ARGUMENTS="${ARGUMENTS} --log-level ${LOG_LEVEL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Starting ProtonMail Bridge: $BRIDGE $ARGUMENTS"
|
||||||
|
$BRIDGE --version
|
||||||
$BRIDGE $ARGUMENTS
|
$BRIDGE $ARGUMENTS
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue