Add build-scripts
parent
b8d5cce6bc
commit
250819c08d
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
scriptPath_file=$(dirname "${BASH_SOURCE[0]}")
|
||||
scriptPath_folder=$(realpath "${scriptPath_file}")
|
||||
utils_path="${scriptPath_folder}/utils"
|
||||
|
||||
# Call prepare
|
||||
printf "# PREPARE\n"
|
||||
source ${utils_path}/prepare.sh
|
||||
|
||||
# Call build
|
||||
printf "# BUILD\n"
|
||||
build_type=${BUILD:-"ownarch"}
|
||||
source ${utils_path}/build-${build_type}.sh
|
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
TAG=${TAG:-"${TAG_PREFIX}${NAME}"}
|
||||
PLATFORM=${PLATFORM:-"linux/amd64,linux/arm64/v8,linux/arm/v7"}
|
||||
EXTRA_ARGS=${EXTRA_ARGS:-"$@"}
|
||||
|
||||
docker buildx build \
|
||||
--platform $PLATFORM \
|
||||
--tag "${TAG}:${VERSION}" \
|
||||
$EXTRA_ARGS \
|
||||
.
|
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
TAG=${TAG:-"${TAG_PREFIX}${NAME}"}
|
||||
EXTRA_ARGS=${EXTRA_ARGS:-"$@"}
|
||||
|
||||
docker build \
|
||||
--tag $TAG:$VERSION \
|
||||
$EXTRA_ARGS \
|
||||
.
|
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
# --- VARIABLES ---
|
||||
# Load variables
|
||||
source $PWD/info.env
|
||||
|
||||
# Check if certain vars are overwritten, set them if missing
|
||||
if [ "${NAME}" = "" ]; then
|
||||
NAME="$(basename $PWD)"
|
||||
fi
|
||||
export NAME
|
||||
printf "Name: ${NAME}\n"
|
||||
|
||||
|
||||
# --- SOURCES ---
|
||||
alias git="git -C .build/repository"
|
||||
# Get sources locally
|
||||
if ! [ -d .build/repository ]; then
|
||||
git clone "${GIT_REPOSITORY}" .build/repository
|
||||
else
|
||||
git checkout - # Checkout previous branch in case GIT_CHECKOUT was different
|
||||
git pull # Get changes
|
||||
fi
|
||||
|
||||
# Checkout when set
|
||||
if [ "$GIT_CHECKOUT" != "" ]; then
|
||||
# Handle special directives
|
||||
if [ "$GIT_CHECKOUT" = "latest-tag" ]; then
|
||||
GIT_CHECKOUT=$(git describe --tags `git rev-list --tags --max-count=1`) # Get latest tag
|
||||
fi
|
||||
|
||||
git checkout $GIT_CHECKOUT
|
||||
fi
|
||||
|
||||
|
||||
# --- VERSION ---
|
||||
# Get current version to build
|
||||
VERSION=$(git describe --tags --long)
|
||||
if [ $? -ne 0 ]; then
|
||||
VERSION=$(git rev-parse HEAD)
|
||||
fi
|
||||
export VERSION
|
||||
printf "Version: ${VERSION}\n"
|
||||
|
||||
TAG=${TAG:-"${TAG_PREFIX}${NAME}"}
|
||||
printf "> ${TAG}\n"
|
Loading…
Reference in New Issue