-
Notifications
You must be signed in to change notification settings - Fork 4
/
buildnow.sh
executable file
·31 lines (24 loc) · 1.13 KB
/
buildnow.sh
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
#!/bin/bash
#shellcheck shell=bash disable=SC2086,SC2015
#
set -x
[[ "$1" != "" ]] && BRANCH="$1" || BRANCH=main
[[ "$BRANCH" == "main" ]] && TAG="latest" || TAG="$BRANCH"
[[ "$ARCHS" == "" ]] && ARCHS="linux/armhf,linux/arm64,linux/amd64,linux/i386"
BASETARGET1=ghcr.io/sdr-enthusiasts
BASETARGET2=kx1t
#IMAGE1="$BASETARGET1/$(pwd | sed -n 's|.*/docker-\(.*\)|\1|p'):$TAG"
#IMAGE2="$BASETARGET2/$(pwd | sed -n 's|.*/docker-\(.*\)|\1|p'):$TAG"
IMAGE1="$BASETARGET1/$(pwd | sed -n 's|.*/\(.*\)|\1|p'):$TAG"
IMAGE2="$BASETARGET2/$(pwd | sed -n 's|.*/\(.*\)|\1|p'):$TAG"
[[ "$IMAGE1" == "$BASETARGET1/reversewebproxy:$TAG" ]] && IMAGE1="$BASETARGET1/webproxy:$TAG" || true
[[ "$IMAGE2" == "$BASETARGET2/reversewebproxy:$TAG" ]] && IMAGE2="$BASETARGET2/webproxy:$TAG" || true
echo "press enter to start building $IMAGE1 and $IMAGE2 from $BRANCH"
read -r
starttime="$(date +%s)"
# rebuild the container
git checkout $BRANCH || exit 2
git pull -a
docker buildx build --compress --push $2 --platform $ARCHS --tag $IMAGE1 .
docker buildx build --compress --push $2 --platform $ARCHS --tag $IMAGE2 .
echo "Total build time: $(( $(date +%s) - starttime )) seconds"