-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |