3 Commits
master ... dev

Author SHA1 Message Date
Xiaonan Shen
5c7c5c50c6 temp x 2023-02-24 23:23:56 +08:00
Xiaonan Shen
bea37a8aa9 Multi arch build 2023-01-14 17:11:58 +08:00
Xiaonan Shen
5284ee3425 Build locally 2023-01-14 16:55:13 +08:00
8 changed files with 127 additions and 144 deletions

View File

@@ -1,57 +0,0 @@
kind: pipeline
type: docker
name: docker-build
steps:
- name: build
image: plugins/docker
settings:
registry: git.jvalver.de
username:
from_secret: username
password:
from_secret: password
repo: git.jvalver.de/thilawyn/protonmail-bridge-docker
dockerfile: build/Dockerfile
dry_run: true
context: build
autotag: true
compress: true
platform: linux/amd64
trigger:
event:
exclude:
- tag
branch:
exclude:
- master
---
kind: pipeline
type: docker
name: docker-build-and-publish
steps:
- name: build-and-publish
image: plugins/docker
settings:
registry: git.jvalver.de
username:
from_secret: username
password:
from_secret: password
repo: git.jvalver.de/thilawyn/protonmail-bridge-docker
dockerfile: build/Dockerfile
context: build
autotag: true
compress: true
platform: linux/amd64
trigger:
event:
exclude:
- pull_request
branch:
- master

View File

@@ -19,74 +19,120 @@ env:
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' }}

View File

@@ -1,4 +1,5 @@
FROM golang:1.20-bookworm 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 git build-essential libsecret-1-dev

View File

@@ -1 +1 @@
3.4.0
3.0.9

11
build/install-golang.sh Normal file
View 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

View File

@@ -1,4 +1,4 @@
FROM ubuntu:jammy
FROM ubuntu:bionic
LABEL maintainer="Xiaonan Shen <s@sxn.dev>"
EXPOSE 25/tcp

View File

@@ -1 +1 @@
3.3.2-1
2.3.0-1

View File

@@ -1,18 +0,0 @@
version: '2.1'
services:
protonmail-bridge:
image: shenxn/protonmail-bridge
# build:
# context: ./build
# dockerfile: Dockerfile
container_name: pm_bridge
ports:
- 1025:25/tcp
- 1143:143/tcp
restart: unless-stopped
stdin_open: true
tty: true
volumes:
protonmail:
name: protonmail