forked from mirrors/protonmail-bridge-docker
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c7c5c50c6 | ||
|
|
bea37a8aa9 | ||
|
|
5284ee3425 | ||
|
|
89b3ef69f4 | ||
|
|
04a2fae963 | ||
|
|
bd9addf4f4 | ||
|
|
c3140a3fa0 | ||
|
|
51015361c5 | ||
|
|
0e92386a93 | ||
|
|
2e3bcdef1f | ||
|
|
cf1e025209 | ||
|
|
4dbf2f806e | ||
|
|
712de23988 | ||
|
|
0541f29d98 | ||
|
|
252397a86d | ||
|
|
6a2a413d0a | ||
|
|
60c8a9ecc4 | ||
|
|
535c80379d | ||
|
|
acefed1b95 | ||
|
|
6decf657c2 | ||
|
|
0fa5f9fc13 | ||
|
|
e0b0ce653c | ||
|
|
fa4ddf7126 | ||
|
|
07d3779fc6 | ||
|
|
2e9d95d90b | ||
|
|
a8f5c0a096 | ||
|
|
14cac1052d | ||
|
|
92b0c5bd5f | ||
|
|
812646acb9 | ||
|
|
664b5e924d | ||
|
|
680e82076e | ||
|
|
86e10823e0 |
178
.github/workflows/build.yaml
vendored
178
.github/workflows/build.yaml
vendored
@@ -16,77 +16,123 @@ on:
|
||||
env:
|
||||
DOCKER_REPO: shenxn/protonmail-bridge
|
||||
DOCKER_REPO_DEV: ghcr.io/shenxn/protonmail-bridge-dev
|
||||
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7
|
||||
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
registry:
|
||||
image: registry:2
|
||||
ports:
|
||||
- 5000:5000
|
||||
build-binary:
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
arch: ["amd64", "arm64", "arm", "riscv64"]
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@master
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: main
|
||||
- name: Set version
|
||||
id: version
|
||||
run: echo "::set-output name=version::`cat build/VERSION`"
|
||||
- name: Set 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
|
||||
- name: Docker meta
|
||||
id: docker_meta
|
||||
uses: crazy-max/ghaction-docker-meta@v1
|
||||
run: echo "version=`cat main/build/VERSION`" >> $GITHUB_OUTPUT
|
||||
- name: Checkout proton bridge repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
images: ${{ steps.repo.outputs.repo }}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
repository: ProtonMail/proton-bridge
|
||||
ref: v${{ steps.version.outputs.version }}
|
||||
path: proton-bridge
|
||||
- name: Set up golang
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
driver-opts: network=host
|
||||
- name: Build image without push to registry
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./build
|
||||
file: ./build/Dockerfile
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
push: true
|
||||
tags: localhost:5000/protonmail-bridge:latest
|
||||
- name: Scan image
|
||||
id: scan
|
||||
uses: anchore/scan-action@v2
|
||||
with:
|
||||
image: localhost:5000/protonmail-bridge:latest
|
||||
fail-build: true
|
||||
severity-cutoff: critical
|
||||
acs-report-enable: true
|
||||
- name: Upload Anchore scan SARIF report
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
with:
|
||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
||||
with:
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v1
|
||||
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
- name: Push image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: ./build
|
||||
file: ./build/Dockerfile
|
||||
platforms: ${{ env.PLATFORMS }}
|
||||
tags: |
|
||||
${{ steps.repo.outputs.repo }}:build
|
||||
${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
go-version: 1.18
|
||||
check-latest: true
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install -y --no-install-recommends build-essential libsecret-1-dev
|
||||
- name: Download go dep
|
||||
if: ${{ matrix.arch == 'arm' }}
|
||||
working-directory: proton-bridge
|
||||
# Build once to download deps.
|
||||
# This step is expected to fail.
|
||||
run: make build-nogui || true
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
- name: Patch for 32 bit arch
|
||||
if: ${{ matrix.arch == 'arm' }}
|
||||
# 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
|
||||
run: find $(go env GOPATH)/pkg/mod/github.com/\!proton\!mail/go-rfc5322*/ -type f -exec sed -i.bak 's/(1<</(int64(1)<</g' {} +
|
||||
- name: Build binary
|
||||
working-directory: proton-bridge
|
||||
run: make build-nogui
|
||||
env:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
# build:
|
||||
# runs-on: ubuntu-latest
|
||||
# services:
|
||||
# registry:
|
||||
# image: registry:2
|
||||
# ports:
|
||||
# - 5000:5000
|
||||
# steps:
|
||||
# - name: Checkout
|
||||
# uses: actions/checkout@master
|
||||
# - name: Set version
|
||||
# id: version
|
||||
# run: echo "::set-output name=version::`cat build/VERSION`"
|
||||
# - name: Set 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
|
||||
# - name: Docker meta
|
||||
# id: docker_meta
|
||||
# uses: crazy-max/ghaction-docker-meta@v1
|
||||
# with:
|
||||
# images: ${{ steps.repo.outputs.repo }}
|
||||
# - name: Set up QEMU
|
||||
# uses: docker/setup-qemu-action@v1
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v1
|
||||
# with:
|
||||
# driver-opts: network=host
|
||||
# - name: Build image without push to registry
|
||||
# uses: docker/build-push-action@v2
|
||||
# with:
|
||||
# context: ./build
|
||||
# file: ./build/Dockerfile
|
||||
# platforms: ${{ env.PLATFORMS }}
|
||||
# push: true
|
||||
# tags: localhost:5000/protonmail-bridge:latest
|
||||
# - name: Scan image
|
||||
# id: scan
|
||||
# uses: anchore/scan-action@v2
|
||||
# with:
|
||||
# image: localhost:5000/protonmail-bridge:latest
|
||||
# fail-build: true
|
||||
# severity-cutoff: critical
|
||||
# acs-report-enable: true
|
||||
# - name: Upload Anchore scan SARIF report
|
||||
# uses: github/codeql-action/upload-sarif@v1
|
||||
# with:
|
||||
# sarif_file: ${{ steps.scan.outputs.sarif }}
|
||||
# - name: Login to DockerHub
|
||||
# uses: docker/login-action@v1
|
||||
# if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
||||
# with:
|
||||
# username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
# password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
# - name: Login to GitHub Container Registry
|
||||
# uses: docker/login-action@v1
|
||||
# if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
|
||||
# with:
|
||||
# registry: ghcr.io
|
||||
# username: ${{ github.repository_owner }}
|
||||
# password: ${{ secrets.CR_PAT }}
|
||||
# - name: Push image
|
||||
# uses: docker/build-push-action@v2
|
||||
# with:
|
||||
# context: ./build
|
||||
# file: ./build/Dockerfile
|
||||
# platforms: ${{ env.PLATFORMS }}
|
||||
# tags: |
|
||||
# ${{ steps.repo.outputs.repo }}:build
|
||||
# ${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
||||
# labels: ${{ steps.docker_meta.outputs.labels }}
|
||||
# push: ${{ github.event_name != 'pull_request' }}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -0,0 +1,3 @@
|
||||
# Ignoring IDE-specific files
|
||||
.idea/*
|
||||
.vscode
|
||||
|
||||
@@ -20,7 +20,7 @@ We now support ARM devices (`arm64` and `arm/v7`)! Use the images tagged with `b
|
||||
|
||||
There are two types of images.
|
||||
- `deb`: Images based on the official [.deb release](https://protonmail.com/bridge/install). It only supports the `amd64` architecture.
|
||||
- `build`: Images based on the [source code](https://github.com/ProtonMail/proton-bridge). It supports `amd64`, `arm64`, and `arm/v7`. Supporting to more architectures is possible. PRs are welcome.
|
||||
- `build`: Images based on the [source code](https://github.com/ProtonMail/proton-bridge). It supports `amd64`, `arm64`, `arm/v7` and `riscv64`. Supporting to more architectures is possible. PRs are welcome.
|
||||
|
||||
tag | description
|
||||
-- | --
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
FROM golang:1.15 AS build
|
||||
# Use carlosedp/golang for riscv64 support
|
||||
FROM carlosedp/golang:1.18 AS build
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y libsecret-1-dev
|
||||
RUN apt-get update && apt-get install -y git build-essential libsecret-1-dev
|
||||
|
||||
# Build
|
||||
WORKDIR /build/
|
||||
COPY build.sh VERSION /build/
|
||||
RUN bash build.sh
|
||||
|
||||
FROM ubuntu:bionic
|
||||
FROM ubuntu:jammy
|
||||
LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
|
||||
|
||||
EXPOSE 25/tcp
|
||||
@@ -23,6 +24,7 @@ RUN apt-get update \
|
||||
COPY gpgparams entrypoint.sh /protonmail/
|
||||
|
||||
# Copy protonmail
|
||||
COPY --from=build /build/proton-bridge/bridge /protonmail/
|
||||
COPY --from=build /build/proton-bridge/proton-bridge /protonmail/
|
||||
|
||||
ENTRYPOINT ["bash", "/protonmail/entrypoint.sh"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.3
|
||||
3.0.9
|
||||
@@ -9,14 +9,15 @@ git clone https://github.com/ProtonMail/proton-bridge.git
|
||||
cd proton-bridge
|
||||
git checkout v$VERSION
|
||||
|
||||
# Build
|
||||
if ! make build-nogui ; then
|
||||
# If build fails it's probably because it is a 32bit
|
||||
# system and there was a overflow error on the parser
|
||||
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' {} +
|
||||
|
||||
# Try again after implementing the workaround
|
||||
make build-nogui
|
||||
fi
|
||||
|
||||
# Build
|
||||
make build-nogui
|
||||
|
||||
@@ -8,6 +8,12 @@ if [[ $1 == init ]]; then
|
||||
# Initialize pass
|
||||
gpg --generate-key --batch /protonmail/gpgparams
|
||||
pass init pass-key
|
||||
|
||||
# Kill the other instance as only one can be running at a time.
|
||||
# This allows users to run entrypoint init inside a running conainter
|
||||
# which is useful in a k8s environment.
|
||||
# || true to make sure this would not fail in case there is no running instance.
|
||||
pkill protonmail-bridge || true
|
||||
|
||||
# Login
|
||||
/protonmail/proton-bridge --cli $@
|
||||
|
||||
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
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.1.1-1
|
||||
2.3.0-1
|
||||
Reference in New Issue
Block a user