forked from mirrors/protonmail-bridge-docker
Build locally
This commit is contained in:
156
.github/workflows/build.yaml
vendored
156
.github/workflows/build.yaml
vendored
@@ -19,74 +19,100 @@ env:
|
|||||||
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
|
PLATFORMS: linux/amd64,linux/arm64/v8,linux/arm/v7,linux/riscv64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-binary:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-22.04
|
||||||
services:
|
|
||||||
registry:
|
|
||||||
image: registry:2
|
|
||||||
ports:
|
|
||||||
- 5000:5000
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: main
|
||||||
- name: Set version
|
- name: Set version
|
||||||
id: version
|
id: version
|
||||||
run: echo "::set-output name=version::`cat build/VERSION`"
|
run: echo "version=`cat main/build/VERSION`" >> $GITHUB_OUTPUT
|
||||||
- name: Set repo
|
- name: Checkout proton bridge repo
|
||||||
id: repo
|
uses: actions/checkout@v3
|
||||||
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:
|
with:
|
||||||
images: ${{ steps.repo.outputs.repo }}
|
repository: ProtonMail/proton-bridge
|
||||||
- name: Set up QEMU
|
ref: v${{ steps.version.outputs.version }}
|
||||||
uses: docker/setup-qemu-action@v1
|
path: proton-bridge
|
||||||
- name: Set up Docker Buildx
|
- name: Set up golang
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
go-version: 1.18
|
||||||
- name: Build image without push to registry
|
check-latest: true
|
||||||
uses: docker/build-push-action@v2
|
- name: Install dependencies
|
||||||
with:
|
run: sudo apt-get install -y --no-install-recommends build-essential libsecret-1-dev
|
||||||
context: ./build
|
- name: Build binary
|
||||||
file: ./build/Dockerfile
|
working-directory: proton-bridge
|
||||||
platforms: ${{ env.PLATFORMS }}
|
run: make build-nogui
|
||||||
push: true
|
# build:
|
||||||
tags: localhost:5000/protonmail-bridge:latest
|
# runs-on: ubuntu-latest
|
||||||
- name: Scan image
|
# services:
|
||||||
id: scan
|
# registry:
|
||||||
uses: anchore/scan-action@v2
|
# image: registry:2
|
||||||
with:
|
# ports:
|
||||||
image: localhost:5000/protonmail-bridge:latest
|
# - 5000:5000
|
||||||
fail-build: true
|
# steps:
|
||||||
severity-cutoff: critical
|
# - name: Checkout
|
||||||
acs-report-enable: true
|
# uses: actions/checkout@master
|
||||||
- name: Upload Anchore scan SARIF report
|
# - name: Set version
|
||||||
uses: github/codeql-action/upload-sarif@v1
|
# id: version
|
||||||
with:
|
# run: echo "::set-output name=version::`cat build/VERSION`"
|
||||||
sarif_file: ${{ steps.scan.outputs.sarif }}
|
# - name: Set repo
|
||||||
- name: Login to DockerHub
|
# id: repo
|
||||||
uses: docker/login-action@v1
|
# 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
|
||||||
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/master' }}
|
# - name: Docker meta
|
||||||
with:
|
# id: docker_meta
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
# uses: crazy-max/ghaction-docker-meta@v1
|
||||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
# with:
|
||||||
- name: Login to GitHub Container Registry
|
# images: ${{ steps.repo.outputs.repo }}
|
||||||
uses: docker/login-action@v1
|
# - name: Set up QEMU
|
||||||
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/dev' }}
|
# uses: docker/setup-qemu-action@v1
|
||||||
with:
|
# - name: Set up Docker Buildx
|
||||||
registry: ghcr.io
|
# uses: docker/setup-buildx-action@v1
|
||||||
username: ${{ github.repository_owner }}
|
# with:
|
||||||
password: ${{ secrets.CR_PAT }}
|
# driver-opts: network=host
|
||||||
- name: Push image
|
# - name: Build image without push to registry
|
||||||
uses: docker/build-push-action@v2
|
# uses: docker/build-push-action@v2
|
||||||
with:
|
# with:
|
||||||
context: ./build
|
# context: ./build
|
||||||
file: ./build/Dockerfile
|
# file: ./build/Dockerfile
|
||||||
platforms: ${{ env.PLATFORMS }}
|
# platforms: ${{ env.PLATFORMS }}
|
||||||
tags: |
|
# push: true
|
||||||
${{ steps.repo.outputs.repo }}:build
|
# tags: localhost:5000/protonmail-bridge:latest
|
||||||
${{ steps.repo.outputs.repo }}:${{ steps.version.outputs.version }}-build
|
# - name: Scan image
|
||||||
labels: ${{ steps.docker_meta.outputs.labels }}
|
# id: scan
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
# 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' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user