Compare commits

..

20 commits
v1.5.4 ... main

Author SHA1 Message Date
6db0b9271c Update for bridge 3.0.x. 2023-02-02 07:48:00 -06:00
9d5ead578d Updated Dockerfile to add bash. 2021-03-08 10:18:56 -06:00
862d2bf49a Restore trigger.
Some checks failed
continuous-integration/drone/tag Build is failing
2021-01-26 13:04:19 -06:00
49f5f6be59 Back to original multiline.
All checks were successful
continuous-integration/drone/push Build is passing
2021-01-26 13:01:40 -06:00
26a1c6226c Alternate YAML multiline.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 12:59:25 -06:00
b32608abb3 Trim whitespace from BUILDX_URL.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 12:45:08 -06:00
ec399a94ec Changed BUILDX_URL line.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 12:42:32 -06:00
219771ec52 Move to single line. 2021-01-26 12:18:39 -06:00
bb980519e4 Additional exec testing.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 12:17:12 -06:00
3c3e3e7727 Test exec runner.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 12:13:50 -06:00
c575b8f86f Try manual push.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 07:52:09 -06:00
7f55378a4d Removed ip6tables.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 07:29:22 -06:00
ed65643608 Add IPv6 to DinD.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-26 07:21:16 -06:00
ebd10ab5b8 Force A record for registry.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-25 20:32:51 -06:00
c192a4fbf3 Remove allow.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-25 20:25:33 -06:00
596ecffb83 CI/CD/buildx testing.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-25 20:21:40 -06:00
26b7e5c3ff Restored trigger.
Some checks failed
continuous-integration/drone/tag Build is failing
2021-01-24 19:12:37 -06:00
4600e81d6b Removed trigger.
Some checks failed
continuous-integration/drone/push Build is failing
2021-01-22 14:52:59 -06:00
efd9a9cb96 CI/CD testing with IPv6. 2021-01-22 14:52:37 -06:00
d3aee1a6db Made CI/CD push step manual.
Some checks failed
continuous-integration/drone/tag Build is failing
2021-01-22 14:26:55 -06:00
4 changed files with 59 additions and 57 deletions

View file

@ -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,21 +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=true \ --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\
. .
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

View file

@ -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

View file

@ -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 "$@"

View file

@ -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