-
Notifications
You must be signed in to change notification settings - Fork 37
77 lines (64 loc) · 2.2 KB
/
build-linux-arm64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Build Linux ARM64
on:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set environment variables
run: |
echo "GOARCH=arm64" >> $GITHUB_ENV
echo "GOOS=linux" >> $GITHUB_ENV
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="v0.0.0-${GITHUB_SHA::8}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "ARCH_NAME=aarch64" >> $GITHUB_ENV
- name: Build for ARM64
env:
DOCKER_BUILDKIT: 1
run: |
# Activate BuildKit and create a new builder
docker buildx create --use --name arm64-builder --platform linux/arm64
docker buildx inspect --bootstrap
# Building images for ARM64
docker buildx build --platform linux/arm64 --load --tag minitia/minitiad-shared:arm64 . -f Dockerfile.arm64
# Extract build output using ARM64 images
mkdir -p ./build
docker create --name temp minitia/minitiad-shared:arm64
docker cp temp:/usr/local/bin/minitiad ./build/
docker rm temp
# Packaging of results
cd ./build
mkdir -p minievm_${VERSION}
mv minitiad minievm_${VERSION}/
tar -czvf minievm_${VERSION}_Linux_${ARCH_NAME}.tar.gz minievm_${VERSION}
mv minievm_${VERSION}_Linux_${ARCH_NAME}.tar.gz ../
# Check build results
cd ..
ls -l
file minievm_${VERSION}_Linux_${ARCH_NAME}.tar.gz
# Remove builder
docker buildx rm arm64-builder
- name: List files
run: ls -l
- name: Release
uses: softprops/action-gh-release@v2
with:
files: |
./minievm_${{ env.VERSION }}_Linux_${{ env.ARCH_NAME }}.tar.gz
env:
VERSION: ${{ env.VERSION }}
ARCH_NAME: ${{ env.ARCH_NAME }}