~nickbp/kapiti

kapiti/docker-build.sh -rwxr-xr-x 581 bytes
4697278fNick Parker Give some files better names (http=>fetcher, then downloader=>updater to avoid confusion with fetcher) 2 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $SCRIPT_DIR

PROJ_NAME=$(basename $SCRIPT_DIR)

DOCKER_REGISTRY=${DOCKER_REGISTRY:=docker.io}
DOCKER_REPOSITORY=${DOCKER_REPOSITORY:="nickbp/${PROJ_NAME}:"}
DOCKER_BUILD=${DOCKER_BUILD:="docker buildx build --push --platform linux/amd64,linux/arm64"}

# Get 7-character commit SHA (note: doesn't detect dirty commits)
COMMIT_SHA=$(git rev-parse HEAD | cut -b 1-7)

time /bin/sh -c "$DOCKER_BUILD -t ${DOCKER_REGISTRY}/${DOCKER_REPOSITORY}${COMMIT_SHA} ."