Skip to content

Commit

Permalink
feat: add multiarch mikrotik builds
Browse files Browse the repository at this point in the history
  • Loading branch information
natesales committed Sep 12, 2021
1 parent 5c3fb84 commit 4c44c80
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions vendorbuild/mikrotik/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
#!/bin/bash

set -e

version=$(git describe --tags "$(git rev-list --tags --max-count=1)" | cut -c2-)

# The docker build command is run in the directory at the root of the project, meaning the Dockerfile needs to reference files according to relative paths
docker build --output type=tar,dest=pathvector-"$version"-mikrotik-amd64.tar -t pathvector-cron:"$version"-amd64 -f ../vendorbuild/mikrotik/Dockerfile ..
# Download docker-buildx if it doesn't already exist
docker_buildx="../vendorbuild/mikrotik/docker-buildx"
if [ ! -d "$docker_buildx" ]; then
curl -L https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 -o $docker_buildx
chmod +x $docker_buildx
fi

# This isn't needed on my machine but it is on GitHub Actions. Not high priority to fix at the moment.
docker save pathvector-cron:"$version"-amd64 > pathvector-"$version"-mikrotik-amd64.tar
for arch in amd64 arm64v8; do
echo "Building for $arch..."
# The build command is run in the directory at the root of the project, so the Dockerfile needs to reference files according to relative paths
$docker_buildx build \
--output type=tar,dest=pathvector-$version-mikrotik-$arch.tar \
-t pathvector-mikrotik:$version-$arch \
--build-arg ARCH=$arch \
-f ../vendorbuild/mikrotik/Dockerfile \
..
done

0 comments on commit 4c44c80

Please sign in to comment.