1
0
Fork 0
mirror of https://github.com/sdr-enthusiasts/docker-adsb-ultrafeeder.git synced 2024-11-24 14:50:09 +00:00
docker-adsb-ultrafeeder/buildnow.sh

38 lines
1.1 KiB
Bash
Raw Normal View History

2023-03-21 19:56:02 +00:00
#!/bin/bash
# shellcheck disable=SC2086,SC2162
[[ "$1" != "" ]] && BRANCH="$1" || BRANCH="$(git branch --show-current)"
[[ "$BRANCH" == "main" ]] && TAG="latest" || TAG="$BRANCH"
[[ "$ARCHS" == "" ]] && ARCHS="linux/armhf,linux/arm64,linux/amd64"
BASETARGET1=ghcr.io/sdr-enthusiasts
2023-10-10 15:25:53 +00:00
#BASETARGET2=kx1t
2023-03-21 19:56:02 +00:00
IMAGE1="$BASETARGET1/$(pwd | sed -n 's|.*/\(docker-.*\)|\1|p'):$TAG"
2023-10-10 15:25:53 +00:00
#IMAGE2="$BASETARGET2/$(pwd | sed -n 's|.*/docker-\(.*\)|\1|p'):$TAG"
2023-03-21 19:56:02 +00:00
2023-03-28 20:03:29 +00:00
echo "press enter to start building $IMAGE1 from $BRANCH"
2023-03-21 19:56:02 +00:00
read
git checkout $BRANCH
starttime="$(date +%s)"
# rebuild the container
set -x
# git pull -a
cp -f Dockerfile Dockerfile.tmp-backup
if [[ "$(uname -s)" == "Darwin" ]]
then
sed -i '' 's/##BRANCH##/'"$BRANCH"'/g' Dockerfile
else
sed -i 's/##BRANCH##/'"$BRANCH"'/g' Dockerfile
fi
docker buildx build -f Dockerfile --compress --push $2 --platform $ARCHS --tag "$IMAGE1" .
2023-03-28 20:03:29 +00:00
# [[ $? ]] && docker buildx build -f Dockerfile --compress --push $2 --platform $ARCHS --tag $IMAGE2 .
2023-03-21 19:56:02 +00:00
mv -f Dockerfile.tmp-backup Dockerfile
echo "Total build time: $(( $(date +%s) - starttime )) seconds"