mirror of
https://github.com/shenxn/protonmail-bridge-docker.git
synced 2026-01-18 06:34:41 +01:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c7c5c50c6 | ||
|
|
bea37a8aa9 | ||
|
|
5284ee3425 |
322
.github/workflows/build.yaml
vendored
322
.github/workflows/build.yaml
vendored
@@ -2,231 +2,137 @@ name: build from source
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/build.yaml
|
- .github/workflows/build.yaml
|
||||||
- build/*
|
- build/*
|
||||||
- VERSION
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/build.yaml
|
- .github/workflows/build.yaml
|
||||||
- build/*
|
- build/*
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GHCR_REPO: shenxn/protonmail-bridge-docker
|
DOCKER_REPO: shenxn/protonmail-bridge
|
||||||
DOCKERHUB_REPO: shenxn/protonmail-bridge
|
DOCKER_REPO_DEV: ghcr.io/shenxn/protonmail-bridge-dev
|
||||||
DOCKER_REPO_DEV: ghcr.io/shenxn/protonmail-bridge
|
|
||||||
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
|
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
build-binary:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
if: github.ref != 'refs/heads/master'
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@master
|
|
||||||
|
|
||||||
- name: Set version
|
|
||||||
id: version
|
|
||||||
run: echo "version=`cat VERSION`" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ env.DOCKER_REPO_DEV }}
|
|
||||||
|
|
||||||
- name: Login to GHCR
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
driver-opts: network=host
|
|
||||||
|
|
||||||
- name: Build and push by digest
|
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
outputs: type=image,"name=${{ env.DOCKER_REPO_DEV }}",push-by-digest=false,name-canonical=true,push=true
|
|
||||||
context: ./build
|
|
||||||
file: ./build/Dockerfile
|
|
||||||
tags: "${{ env.DOCKER_REPO_DEV }}:dev-${{ github.ref_name }}"
|
|
||||||
build-args: |
|
|
||||||
version=${{ env.version }}
|
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scan
|
|
||||||
uses: aquasecurity/trivy-action@0.30.0
|
|
||||||
with:
|
|
||||||
image-ref: "${{ env.DOCKER_REPO_DEV }}:dev-${{ github.ref_name }}"
|
|
||||||
format: 'sarif'
|
|
||||||
exit-code: 0
|
|
||||||
severity: 'CRITICAL,HIGH'
|
|
||||||
output: 'trivy-results.sarif'
|
|
||||||
|
|
||||||
- name: Upload Trivy scan SARIF report
|
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
|
||||||
with:
|
|
||||||
sarif_file: 'trivy-results.sarif'
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
platform:
|
arch: ["amd64", "arm64", "arm", "riscv64"]
|
||||||
- linux/amd64
|
fail-fast: true
|
||||||
- linux/arm64/v8
|
|
||||||
- linux/arm/v7
|
|
||||||
- linux/riscv64
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
- name: Prepare
|
path: main
|
||||||
run: |
|
|
||||||
platform=${{ matrix.platform }}
|
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set version
|
- name: Set version
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=`cat VERSION`" >> $GITHUB_ENV
|
run: echo "version=`cat main/build/VERSION`" >> $GITHUB_OUTPUT
|
||||||
|
- name: Checkout proton bridge repo
|
||||||
- name: Docker meta
|
uses: actions/checkout@v3
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
with:
|
||||||
images: |
|
repository: ProtonMail/proton-bridge
|
||||||
${{ env.DOCKERHUB_REPO }}
|
ref: v${{ steps.version.outputs.version }}
|
||||||
${{ env.GHCR_REPO }}
|
path: proton-bridge
|
||||||
|
- name: Set up golang
|
||||||
- name: Login to Docker Hub
|
uses: actions/setup-go@v3
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
go-version: 1.18
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
check-latest: true
|
||||||
|
- name: Install dependencies
|
||||||
- name: Login to GHCR
|
run: sudo apt-get install -y --no-install-recommends build-essential libsecret-1-dev
|
||||||
uses: docker/login-action@v3
|
- name: Download go dep
|
||||||
with:
|
if: ${{ matrix.arch == 'arm' }}
|
||||||
registry: ghcr.io
|
working-directory: proton-bridge
|
||||||
username: ${{ github.repository_owner }}
|
# Build once to download deps.
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
# This step is expected to fail.
|
||||||
|
run: make build-nogui || true
|
||||||
- name: Set up QEMU
|
env:
|
||||||
uses: docker/setup-qemu-action@v3
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
- name: Patch for 32 bit arch
|
||||||
- name: Set up Docker Buildx
|
if: ${{ matrix.arch == 'arm' }}
|
||||||
uses: docker/setup-buildx-action@v3
|
# For 32bit architectures, there was a overflow error on the parser
|
||||||
|
# This is a workaround for this problem found at:
|
||||||
- name: Build and push by digest
|
# https://github.com/antlr/antlr4/issues/2433#issuecomment-774514106
|
||||||
id: build
|
run: find $(go env GOPATH)/pkg/mod/github.com/\!proton\!mail/go-rfc5322*/ -type f -exec sed -i.bak 's/(1<</(int64(1)<</g' {} +
|
||||||
uses: docker/build-push-action@v6
|
- name: Build binary
|
||||||
with:
|
working-directory: proton-bridge
|
||||||
platforms: ${{ matrix.platform }}
|
run: make build-nogui
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
env:
|
||||||
outputs: type=image,"name=name=${{ env.DOCKERHUB_REPO }},${{ env.GHCR_REPO }}",push-by-digest=true,name-canonical=true,push=false
|
GOARCH: ${{ matrix.arch }}
|
||||||
context: ./build
|
# build:
|
||||||
file: ./build/Dockerfile
|
# runs-on: ubuntu-latest
|
||||||
tags: |
|
# services:
|
||||||
"${{ env.DOCKERHUB_REPO }}:build"
|
# registry:
|
||||||
"${{ env.DOCKERHUB_REPO }}:${{ env.version }}-build"
|
# image: registry:2
|
||||||
"${{ env.GHCR_REPO }}:build"
|
# ports:
|
||||||
"${{ env.GHCR_REPO }}:${{ env.version }}-build"
|
# - 5000:5000
|
||||||
provenance: false
|
# steps:
|
||||||
sbom: false
|
# - name: Checkout
|
||||||
build-args: |
|
# uses: actions/checkout@master
|
||||||
version=${{ env.version }}
|
# - name: Set version
|
||||||
|
# id: version
|
||||||
- name: Export digest
|
# run: echo "::set-output name=version::`cat build/VERSION`"
|
||||||
run: |
|
# - name: Set repo
|
||||||
mkdir -p ${{ runner.temp }}/digests
|
# id: repo
|
||||||
digest="${{ steps.build.outputs.digest }}"
|
# run: if [[ $GITHUB_REF == "refs/heads/master" ]]; then echo "::set-output name=repo::${DOCKER_REPO}"; else echo "::set-output name=repo::${DOCKER_REPO_DEV}"; fi
|
||||||
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
# - name: Docker meta
|
||||||
|
# id: docker_meta
|
||||||
- name: Upload digest
|
# uses: crazy-max/ghaction-docker-meta@v1
|
||||||
uses: actions/upload-artifact@v4
|
# with:
|
||||||
with:
|
# images: ${{ steps.repo.outputs.repo }}
|
||||||
name: digests-${{ env.PLATFORM_PAIR }}
|
# - name: Set up QEMU
|
||||||
path: ${{ runner.temp }}/digests/*
|
# uses: docker/setup-qemu-action@v1
|
||||||
if-no-files-found: error
|
# - name: Set up Docker Buildx
|
||||||
retention-days: 1
|
# uses: docker/setup-buildx-action@v1
|
||||||
|
# with:
|
||||||
|
# driver-opts: network=host
|
||||||
merge:
|
# - name: Build image without push to registry
|
||||||
runs-on: ubuntu-latest
|
# uses: docker/build-push-action@v2
|
||||||
needs:
|
# with:
|
||||||
- build
|
# context: ./build
|
||||||
steps:
|
# file: ./build/Dockerfile
|
||||||
- name: Download digests
|
# platforms: ${{ env.PLATFORMS }}
|
||||||
uses: actions/download-artifact@v4
|
# push: true
|
||||||
with:
|
# tags: localhost:5000/protonmail-bridge:latest
|
||||||
path: ${{ runner.temp }}/digests
|
# - name: Scan image
|
||||||
pattern: digests-*
|
# id: scan
|
||||||
merge-multiple: true
|
# uses: anchore/scan-action@v2
|
||||||
|
# with:
|
||||||
- name: Set version
|
# image: localhost:5000/protonmail-bridge:latest
|
||||||
id: version
|
# fail-build: true
|
||||||
run: echo "version=`cat VERSION`" >> $GITHUB_ENV
|
# severity-cutoff: critical
|
||||||
|
# acs-report-enable: true
|
||||||
- name: Login to Docker Hub
|
# - name: Upload Anchore scan SARIF report
|
||||||
uses: docker/login-action@v3
|
# uses: github/codeql-action/upload-sarif@v1
|
||||||
with:
|
# with:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
# sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
# - name: Login to DockerHub
|
||||||
|
# uses: docker/login-action@v1
|
||||||
- name: Login to GHCR
|
# if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
||||||
uses: docker/login-action@v3
|
# with:
|
||||||
with:
|
# username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
registry: ghcr.io
|
# password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
username: ${{ github.repository_owner }}
|
# - name: Login to GitHub Container Registry
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
# uses: docker/login-action@v1
|
||||||
|
# if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
|
||||||
- name: Set up Docker Buildx
|
# with:
|
||||||
uses: docker/setup-buildx-action@v3
|
# registry: ghcr.io
|
||||||
with:
|
# username: ${{ github.repository_owner }}
|
||||||
driver-opts: network=host
|
# password: ${{ secrets.CR_PAT }}
|
||||||
|
# - name: Push image
|
||||||
- name: Docker meta
|
# uses: docker/build-push-action@v2
|
||||||
id: meta
|
# with:
|
||||||
uses: docker/metadata-action@v5
|
# context: ./build
|
||||||
with:
|
# file: ./build/Dockerfile
|
||||||
images: |
|
# platforms: ${{ env.PLATFORMS }}
|
||||||
${{ env.DOCKERHUB_REPO }}
|
# tags: |
|
||||||
${{ env.GHCR_REPO }}
|
# ${{ steps.repo.outputs.repo }}:build
|
||||||
tags: |
|
# ${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
||||||
type=raw,enable=true,value=${{ env.version }}-build
|
# labels: ${{ steps.docker_meta.outputs.labels }}
|
||||||
type=raw,enable=true,suffix=,value=build
|
# push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|
||||||
- name: Create manifest list and push
|
|
||||||
working-directory: ${{ runner.temp }}/digests
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
||||||
$(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)
|
|
||||||
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
|
|
||||||
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
|
|
||||||
|
|
||||||
- name: Run Trivy vulnerability scan
|
|
||||||
uses: aquasecurity/trivy-action@0.30.0
|
|
||||||
with:
|
|
||||||
image-ref: "${{ env.DOCKERHUB_REPO }}:${{ env.version }}-build"
|
|
||||||
format: 'sarif'
|
|
||||||
exit-code: 0
|
|
||||||
severity: 'CRITICAL,HIGH'
|
|
||||||
output: 'trivy-results.sarif'
|
|
||||||
- name: Upload Trivy scan SARIF report
|
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
|
||||||
with:
|
|
||||||
sarif_file: 'trivy-results.sarif'
|
|
||||||
|
|
||||||
- name: Inspect image
|
|
||||||
run: |
|
|
||||||
docker buildx imagetools inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.meta.outputs.version }}
|
|
||||||
docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }}
|
|
||||||
|
|||||||
15
.github/workflows/deb.yaml
vendored
15
.github/workflows/deb.yaml
vendored
@@ -2,15 +2,16 @@ name: pack from deb
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/deb.yaml
|
- .github/workflows/deb.yaml
|
||||||
- deb/*
|
- deb/*
|
||||||
- VERSION
|
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/deb.yaml
|
- .github/workflows/deb.yaml
|
||||||
- deb/*
|
- deb/*
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_REPO: shenxn/protonmail-bridge
|
DOCKER_REPO: shenxn/protonmail-bridge
|
||||||
@@ -24,7 +25,7 @@ jobs:
|
|||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
- name: Set version
|
- name: Set version
|
||||||
id: version
|
id: version
|
||||||
run: echo "version=`cat VERSION`" >> $GITHUB_ENV
|
run: echo "::set-output name=version::`cat deb/VERSION`"
|
||||||
- name: Set repo
|
- name: Set repo
|
||||||
id: repo
|
id: repo
|
||||||
run: if [[ $GITHUB_REF == "refs/heads/master" ]]; then echo "::set-output name=repo::${DOCKER_REPO}"; else echo "::set-output name=repo::${DOCKER_REPO_DEV}"; fi
|
run: if [[ $GITHUB_REF == "refs/heads/master" ]]; then echo "::set-output name=repo::${DOCKER_REPO}"; else echo "::set-output name=repo::${DOCKER_REPO_DEV}"; fi
|
||||||
@@ -51,18 +52,18 @@ jobs:
|
|||||||
severity-cutoff: critical
|
severity-cutoff: critical
|
||||||
acs-report-enable: true
|
acs-report-enable: true
|
||||||
- name: Upload Anchore scan SARIF report
|
- name: Upload Anchore scan SARIF report
|
||||||
uses: github/codeql-action/upload-sarif@v3
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
with:
|
with:
|
||||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
@@ -74,6 +75,6 @@ jobs:
|
|||||||
file: ./deb/Dockerfile
|
file: ./deb/Dockerfile
|
||||||
tags: |
|
tags: |
|
||||||
${{ steps.repo.outputs.repo }}:latest
|
${{ steps.repo.outputs.repo }}:latest
|
||||||
${{ steps.repo.outputs.repo }}:${{ env.version }}
|
${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
|||||||
3
.github/workflows/update-check.yaml
vendored
3
.github/workflows/update-check.yaml
vendored
@@ -2,6 +2,9 @@ name: update check
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- dev
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/update-check.yaml
|
- .github/workflows/update-check.yaml
|
||||||
- update-check.py
|
- update-check.py
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -37,13 +37,7 @@ To initialize and add account to the bridge, run the following command.
|
|||||||
docker run --rm -it -v protonmail:/root shenxn/protonmail-bridge init
|
docker run --rm -it -v protonmail:/root shenxn/protonmail-bridge init
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to use Docker Compose instead, you can create a copy of the provided example [docker-compose.yml](docker-compose.yml) file, modify it to suit your needs, and then run the following command:
|
Wait for the bridge to startup, use `login` command and follow the instructions to add your account into the bridge. Then use `info` to see the configuration information (username and password). After that, use `exit` to exit the bridge. You may need `CTRL+C` to exit the docker entirely.
|
||||||
|
|
||||||
```
|
|
||||||
docker compose run protonmail-bridge init
|
|
||||||
```
|
|
||||||
|
|
||||||
Wait for the bridge to startup, then you will see a prompt appear for [Proton Mail Bridge interactive shell](https://proton.me/support/bridge-cli-guide). Use the `login` command and follow the instructions to add your account into the bridge. Then use `info` to see the configuration information (username and password). After that, use `exit` to exit the bridge. You may need `CTRL+C` to exit the docker entirely.
|
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
@@ -53,12 +47,6 @@ To run the container, use the following command.
|
|||||||
docker run -d --name=protonmail-bridge -v protonmail:/root -p 1025:25/tcp -p 1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
|
docker run -d --name=protonmail-bridge -v protonmail:/root -p 1025:25/tcp -p 1143:143/tcp --restart=unless-stopped shenxn/protonmail-bridge
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, if using Docker Compose, use the following command.
|
|
||||||
|
|
||||||
```
|
|
||||||
docker compose up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## Kubernetes
|
## Kubernetes
|
||||||
|
|
||||||
If you want to run this image in a Kubernetes environment. You can use the [Helm](https://helm.sh/) chart (https://github.com/k8s-at-home/charts/tree/master/charts/stable/protonmail-bridge) created by [@Eagleman7](https://github.com/Eagleman7). More details can be found in [#23](https://github.com/shenxn/protonmail-bridge-docker/issues/23).
|
If you want to run this image in a Kubernetes environment. You can use the [Helm](https://helm.sh/) chart (https://github.com/k8s-at-home/charts/tree/master/charts/stable/protonmail-bridge) created by [@Eagleman7](https://github.com/Eagleman7). More details can be found in [#23](https://github.com/shenxn/protonmail-bridge-docker/issues/23).
|
||||||
|
|||||||
8
build/.dockerignore
Normal file
8
build/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
*
|
||||||
|
|
||||||
|
!.dockerignore
|
||||||
|
!VERSION
|
||||||
|
!entrypoint.sh
|
||||||
|
!gpgparams
|
||||||
|
!Dockerfile
|
||||||
|
!build.sh
|
||||||
@@ -1,18 +1,16 @@
|
|||||||
# The build image could be golang, but it currently does not support riscv64. Only debian:sid does, at the time of writing.
|
# Use carlosedp/golang for riscv64 support
|
||||||
FROM debian:sid-slim AS build
|
FROM carlosedp/golang:1.18 AS build
|
||||||
|
|
||||||
ARG version
|
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN apt-get update && apt-get install -y golang build-essential libsecret-1-dev
|
RUN apt-get update && apt-get install -y git build-essential libsecret-1-dev
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
ADD https://github.com/ProtonMail/proton-bridge.git#${version} /build/
|
|
||||||
WORKDIR /build/
|
WORKDIR /build/
|
||||||
RUN make build-nogui vault-editor
|
COPY build.sh VERSION /build/
|
||||||
|
RUN bash build.sh
|
||||||
|
|
||||||
FROM debian:sid-slim
|
FROM ubuntu:jammy
|
||||||
LABEL maintainer="Simon Felding <sife@adm.ku.dk>"
|
LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
|
||||||
|
|
||||||
EXPOSE 25/tcp
|
EXPOSE 25/tcp
|
||||||
EXPOSE 143/tcp
|
EXPOSE 143/tcp
|
||||||
@@ -26,8 +24,7 @@ RUN apt-get update \
|
|||||||
COPY gpgparams entrypoint.sh /protonmail/
|
COPY gpgparams entrypoint.sh /protonmail/
|
||||||
|
|
||||||
# Copy protonmail
|
# Copy protonmail
|
||||||
COPY --from=build /build/bridge /protonmail/
|
COPY --from=build /build/proton-bridge/bridge /protonmail/
|
||||||
COPY --from=build /build/proton-bridge /protonmail/
|
COPY --from=build /build/proton-bridge/proton-bridge /protonmail/
|
||||||
COPY --from=build /build/vault-editor /protonmail/
|
|
||||||
|
|
||||||
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||||
|
|||||||
1
build/VERSION
Normal file
1
build/VERSION
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0.9
|
||||||
23
build/build.sh
Normal file
23
build/build.sh
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
VERSION=`cat VERSION`
|
||||||
|
|
||||||
|
# Clone new code
|
||||||
|
git clone https://github.com/ProtonMail/proton-bridge.git
|
||||||
|
cd proton-bridge
|
||||||
|
git checkout v$VERSION
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
if [[ $ARCH == "armv7l" ]] ; then
|
||||||
|
# This is expected to fail, and we use the following patch to fix
|
||||||
|
make build-nogui || true
|
||||||
|
# For 32bit architectures, there was a overflow error on the parser
|
||||||
|
# This is a workaround for this problem found at:
|
||||||
|
# https://github.com/antlr/antlr4/issues/2433#issuecomment-774514106
|
||||||
|
find $(go env GOPATH)/pkg/mod/github.com/\!proton\!mail/go-rfc5322*/ -type f -exec sed -i.bak 's/(1<</(int64(1)<</g' {} +
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build
|
||||||
|
make build-nogui
|
||||||
11
build/install-golang.sh
Normal file
11
build/install-golang.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
GOLANG_VERSION=1.18.7
|
||||||
|
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
if [[ $ARCH == "riscv64" ]]; then
|
||||||
|
# There is no official riscv64 release. Use carlosedp/riscv-bringup instead.
|
||||||
|
wget
|
||||||
|
|
||||||
8
deb/.dockerignore
Normal file
8
deb/.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
*
|
||||||
|
|
||||||
|
!.dockerignore
|
||||||
|
!VERSION
|
||||||
|
!entrypoint.sh
|
||||||
|
!install.sh
|
||||||
|
!gpgparams
|
||||||
|
!Dockerfile
|
||||||
@@ -1,16 +1,5 @@
|
|||||||
### The Deb install is just a repack of the official ProtonMail Bridge deb package with less dependencies.
|
FROM ubuntu:bionic
|
||||||
### I recommend you don't use this. It's here for legacy reasons.
|
LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
|
||||||
|
|
||||||
FROM debian:sid-slim AS build
|
|
||||||
|
|
||||||
COPY install.sh PACKAGE /
|
|
||||||
RUN apt-get update && apt-get install -y wget binutils
|
|
||||||
|
|
||||||
# Repack deb (removes unnecessary dependencies and produces /protonmail.deb)
|
|
||||||
RUN bash /install.sh
|
|
||||||
|
|
||||||
FROM debian:sid-slim
|
|
||||||
LABEL maintainer="Simon Felding <sife@adm.ku.dk>"
|
|
||||||
|
|
||||||
EXPOSE 25/tcp
|
EXPOSE 25/tcp
|
||||||
EXPOSE 143/tcp
|
EXPOSE 143/tcp
|
||||||
@@ -18,11 +7,9 @@ EXPOSE 143/tcp
|
|||||||
WORKDIR /protonmail
|
WORKDIR /protonmail
|
||||||
|
|
||||||
# Copy bash scripts
|
# Copy bash scripts
|
||||||
COPY gpgparams entrypoint.sh PACKAGE /protonmail/
|
COPY gpgparams install.sh entrypoint.sh VERSION /protonmail/
|
||||||
COPY --from=build /protonmail.deb /tmp/protonmail.deb
|
|
||||||
|
|
||||||
RUN apt-get update \
|
# Install dependencies and protonmail bridge
|
||||||
&& apt-get install -y --no-install-recommends /tmp/protonmail.deb socat pass libsecret-1-0 ca-certificates procps \
|
RUN bash install.sh
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
CMD ["bash", "/protonmail/entrypoint.sh"]
|
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
https://github.com/ProtonMail/proton-bridge/releases/download/v3.21.2/protonmail-bridge_3.21.2-1_amd64.deb
|
|
||||||
1
deb/VERSION
Normal file
1
deb/VERSION
Normal file
@@ -0,0 +1 @@
|
|||||||
|
2.3.0-1
|
||||||
@@ -1,16 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -ex
|
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)
|
# Repack deb (remove unnecessary dependencies)
|
||||||
mkdir deb
|
mkdir deb
|
||||||
wget -i /PACKAGE -O /deb/protonmail.deb
|
|
||||||
cd deb
|
cd deb
|
||||||
ar x -v protonmail.deb
|
wget -q https://protonmail.com/download/bridge/${DEB_FILE}
|
||||||
|
ar x -v ${DEB_FILE}
|
||||||
mkdir control
|
mkdir control
|
||||||
tar zxvf control.tar.gz -C control
|
tar zxvf control.tar.gz -C control
|
||||||
sed -i "s/^Depends: .*$/Depends: libgl1, libc6, libsecret-1-0, libstdc++6, libgcc1/" control/control
|
sed -i "s/^Depends: .*$/Depends: libgl1, libc6, libsecret-1-0, libstdc++6, libgcc1/" control/control
|
||||||
cd control
|
cd control
|
||||||
tar zcvf ../control.tar.gz .
|
tar zcvf ../control.tar.gz .
|
||||||
cd ../
|
cd ../
|
||||||
|
ar rcs -v ${DEB_FILE} debian-binary control.tar.gz data.tar.gz
|
||||||
|
cd ../
|
||||||
|
|
||||||
ar rcs -v /protonmail.deb debian-binary control.tar.gz data.tar.gz
|
# 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
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
version: '2.1'
|
|
||||||
|
|
||||||
services:
|
|
||||||
protonmail-bridge:
|
|
||||||
image: shenxn/protonmail-bridge
|
|
||||||
ports:
|
|
||||||
- 1025:25/tcp
|
|
||||||
- 1143:143/tcp
|
|
||||||
restart: unless-stopped
|
|
||||||
volumes:
|
|
||||||
- protonmail:/root
|
|
||||||
volumes:
|
|
||||||
protonmail:
|
|
||||||
name: protonmail
|
|
||||||
@@ -1,37 +1,64 @@
|
|||||||
import requests, os, sys
|
import sys
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
def git(command):
|
|
||||||
return os.system(f"git {command}")
|
|
||||||
|
|
||||||
|
|
||||||
release = requests.get("https://api.github.com/repos/protonmail/proton-bridge/releases/latest").json()
|
|
||||||
version = release['tag_name']
|
|
||||||
deb = [asset for asset in release ['assets'] if asset['name'].endswith('.deb')][0]['browser_download_url']
|
|
||||||
|
|
||||||
print(f"Latest release is: {version}")
|
|
||||||
|
|
||||||
with open("VERSION", 'w') as f:
|
|
||||||
f.write(version)
|
|
||||||
|
|
||||||
with open("deb/PACKAGE", 'w') as f:
|
|
||||||
f.write(deb)
|
|
||||||
|
|
||||||
git("config --local user.name 'GitHub Actions'")
|
|
||||||
git("config --local user.email 'actions@github.com'")
|
|
||||||
|
|
||||||
git("add -A")
|
|
||||||
|
|
||||||
if git("diff --cached --quiet") == 0: # Returns 0 if there are no changes
|
|
||||||
print("Version didn't change")
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
git(f"commit -m 'Bump version to {version}'")
|
|
||||||
is_pull_request = sys.argv[1] == "true"
|
is_pull_request = sys.argv[1] == "true"
|
||||||
|
print(f"is_pull_request={is_pull_request}")
|
||||||
|
|
||||||
if is_pull_request:
|
|
||||||
print("This is a pull request, skipping push step.")
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
if git("push") != 0:
|
def check_version(directory, new_version):
|
||||||
print("Git push failed!")
|
print(f"Checking version for {directory}")
|
||||||
exit(1)
|
|
||||||
|
if not new_version:
|
||||||
|
print("Failed to get new version. Exiting.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
with open(f"{directory}/VERSION", "r") as f:
|
||||||
|
old_version = f.read().rstrip()
|
||||||
|
|
||||||
|
print(f"Up-to-date version {new_version}")
|
||||||
|
print(f"Current version: {old_version}")
|
||||||
|
|
||||||
|
if old_version != new_version:
|
||||||
|
print(f"New release found: {new_version}")
|
||||||
|
|
||||||
|
# bump up to new release
|
||||||
|
with open(f"{directory}/VERSION", "w") as f:
|
||||||
|
f.write(new_version)
|
||||||
|
# commit
|
||||||
|
result = os.system(f"git config --local user.email 'actions@github.com' \
|
||||||
|
&& git config --local user.name 'GitHub Actions' \
|
||||||
|
&& git add {directory}/VERSION \
|
||||||
|
&& git commit -m 'Bump {directory} version to {new_version}'")
|
||||||
|
if result != 0:
|
||||||
|
print("Failed to commit the bump. Exiting")
|
||||||
|
exit(1)
|
||||||
|
if is_pull_request:
|
||||||
|
print("Action triggered by pull request. Do not push.")
|
||||||
|
else:
|
||||||
|
result = os.system("git push")
|
||||||
|
if result != 0:
|
||||||
|
print("Failed to push. Exiting")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
print(f"Already newest version {old_version}")
|
||||||
|
|
||||||
|
|
||||||
|
# check deb version
|
||||||
|
response = requests.get("https://protonmail.com/download/current_version_linux.json")
|
||||||
|
content = json.loads(response.content)
|
||||||
|
version = re.match(".*_([0-9.-]+)_amd64\.deb", content["DebFile"]).group(1)
|
||||||
|
check_version("deb", version)
|
||||||
|
|
||||||
|
|
||||||
|
# check build version
|
||||||
|
response = requests.get(
|
||||||
|
"https://api.github.com/repos/ProtonMail/proton-bridge/tags",
|
||||||
|
headers={"Accept": "application/vnd.github.v3+json"},
|
||||||
|
)
|
||||||
|
tags = json.loads(response.content)
|
||||||
|
version_re = re.compile("v\d+\.\d+\.\d+")
|
||||||
|
releases = [tag["name"][1:] for tag in tags if version_re.match(tag["name"])]
|
||||||
|
check_version("build", releases[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user