Compare commits

..

No commits in common. "main" and "v1.5.6" have entirely different histories.
main ... v1.5.6

4 changed files with 56 additions and 56 deletions

View file

@ -1,6 +1,6 @@
--- ---
kind: pipeline kind: pipeline
type: exec type: docker
name: default name: default
environment: environment:
@ -10,8 +10,22 @@ 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
@ -27,12 +41,12 @@ steps:
;; ;;
esac esac
- |- - |-
export BUILDX_URL=$(\ export BUILDX_URL=$( \
wget -q -O - https://api.github.com/repos/docker/buildx/releases/latest\ wget -q -O - \
| grep "browser_download_url.*linux-$ARCH"\ https://api.github.com/repos/docker/buildx/releases/latest \
| cut -d: -f2,3\ | grep "browser_download_url.*linux-$ARCH" \
| tr -d \"\ | cut -d: -f2,3 \
| 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
@ -40,19 +54,23 @@ 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 \
--no-cache\ --platform linux/amd64,linux/arm64 \
--platform linux/amd64,linux/arm64\ --output=type=image,push=false \
--output type=image,push=true\ --progress tty \
--progress tty\ --build-arg TAG=$DRONE_TAG \
--build-arg TAG=$DRONE_TAG\ -t $REGISTRY_HOST/$IMAGE:$DRONE_TAG \
-t $REGISTRY_HOST/$IMAGE:$DRONE_TAG\ -t $REGISTRY_HOST/$IMAGE:latest \
-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

View file

@ -1,27 +1,22 @@
# Build the ProtonMail Bridge. # Build the ProtonMail Bridge.
FROM golang:1.18-buster as build FROM golang:1.15-alpine as build
ENV LANG C.UTF-8 ENV LANG C.UTF-8
RUN apk add --no-cache \
# Install required build packages
RUN apt-get update \
&& apt-get install -y \
bash \
build-essential \
curl \ curl \
gcc \
git \ git \
libsecret-1-dev \ libsecret-dev \
make \
musl-dev musl-dev
# Download/build the application
WORKDIR /usr/src 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 \
&& export PROTON_BRIDGE="proton-bridge-$(echo $RELEASE | sed -e 's/^\(v\|br\)//')" \ && ln -s "proton-bridge-$RELEASE" proton-bridge \
&& ln -s "${PROTON_BRIDGE}" proton-bridge \ && cd 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 \
@ -30,26 +25,21 @@ 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 debian:stable FROM alpine:edge
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 apt-get update\ RUN apk add --no-cache \
&& apt-get install -y --no-install-recommends --no-install-suggests\ libsecret \
libcap2\ pass \
libsecret-1-0\ socat \
gosu\ su-exec \
gpg-agent\ && chmod +x /bin/entrypoint \
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,11 +9,13 @@ 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 ($USER_ID) with group $GROUP ${GROUP_ID}..." echo "Adding user proton with group $GROUP..."
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
@ -25,5 +27,4 @@ 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 &
echo "Starting ProtonMail Bridge..." exec /sbin/su-exec proton "$@"
exec /usr/sbin/gosu proton "$@"

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
set -eufo pipefail set -eufo pipefail
BRIDGE=/bin/bridge BRIDGE=/bin/proton-bridge
FIFO=/tmp/fifo FIFO=/tmp/fifo
PRINT_INFO=${PRINT_INFO:-""} PRINT_INFO=${PRINT_INFO:-""}
@ -11,20 +11,14 @@ 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
@ -34,7 +28,6 @@ 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
@ -44,6 +37,4 @@ 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