Add github actions for multiarch

This commit is contained in:
Xiaonan Shen 2020-06-01 07:06:41 -07:00
parent 55175292b0
commit 635fb1d8b1
No known key found for this signature in database
GPG Key ID: 211BF560D12417F5
4 changed files with 65 additions and 1 deletions

35
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,35 @@
name: build from source
on:
push:
branches:
- master
- dev
paths:
- .github/workflows/build.yaml
- build/.dockerignore
- build/build-docker.sh
- build/build.sh
- build/Dockerfile
- build/entrypoint.sh
- build/gpgparams
- build/VERSION
env:
DOCKER_TAG: shenxn/protonmail-bridge
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Docker login
uses: azure/docker-login@v1
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_USERNAME }}
- name: Set up Docker buildx
uses: crazy-max/ghaction-docker-buildx@v2
- name: Build image
run: bash build/build-docker.sh

View File

@ -16,7 +16,7 @@ on:
- VERSION - VERSION
env: env:
DOCKER_TAG: shenxn/protonmail-bridge DOCKER_REPO: shenxn/protonmail-bridge
jobs: jobs:
build: build:

21
build/build-docker.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -ex
# Enter the right path
SCRIPT=`realpath $0`
SCRIPTPATH=`dirname $SCRIPT`
cd $SCRIPTPATH
# Set docker tag
VERSION=`cat VERSION`
if [[ $GITHUB_REF == "refs/heads/master" ]]; then
TAG_TYPE="build"
TAG_VERTION="${VERSION}-build"
else
TAG_TYPE="build-dev"
TAG_VERTION="${VERSION}-build-dev"
fi
# Build multiarch and push
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 -t ${DOCKER_REPO}:${TAG_TYPE} -t ${DOCKER_REPO}:${TAG_VERSION} --push .

8
build/gpgparams Normal file
View File

@ -0,0 +1,8 @@
%no-protection
%echo Generating a basic OpenPGP key
Key-Type: RSA
Key-Length: 2048
Name-Real: pass-key
Expire-Date: 0
%commit
%echo done