Skip to content

Multi Arch Build for Alpine #961

Multi Arch Build for Alpine

Multi Arch Build for Alpine #961

Workflow file for this run

---
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:
name: Multi Arch Build for Alpine
jobs:
build:
name: Build Binaries with musl
runs-on: ubuntu-latest
strategy:
matrix:
target:
- armv7-unknown-linux-musleabihf
- aarch64-unknown-linux-musl
- x86_64-unknown-linux-musl
steps:
- name: Checkout boringtun
uses: actions/checkout@v4
with:
repository: cloudflare/boringtun
- uses: dtolnay/rust-toolchain@stable
- name: install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: install binary
run: cross build --target ${{ matrix.target }} --release --bin boringtun-cli
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/boringtun-cli
- id: sha
run: echo "sha=$(git describe --always --tags --dirty)" >> $GITHUB_OUTPUT
outputs:
sha: ${{ steps.sha.outputs.sha }}
push:
name: docker build and push images
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: aarch64-unknown-linux-musl
path: linux/arm64/
- uses: actions/download-artifact@v4
with:
name: armv7-unknown-linux-musleabihf
path: linux/arm/v7/
- uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux-musl
path: linux/amd64/
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER}}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64, linux/arm, linux/amd64
file: ./Dockerfile
push: ${{github.ref_name == 'main'}}
build-args: |
FROM=alpine:3.17
tags: |-
leonnicolas/boringtun:alpine
leonnicolas/boringtun:alpine-${{ needs.build.outputs.sha }}
ghcr.io/leonnicolas/boringtun:alpine
ghcr.io/leonnicolas/boringtun:alpine-${{ needs.build.outputs.sha }}