first commit

This commit is contained in:
root
2026-03-30 10:05:53 +00:00
commit 59f6583862
8465 changed files with 541514 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
#!/usr/bin/env bash
###############################################################################
# Actual script directory path
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Load Container IMAGE_NAME and IMAGE_TAG variables
source ${DIR}/set_container_vars.sh
# Setup
IMAGE_NAME="${REGISTRY_REPO}:${IMAGE_TAG}"
CONTAINER_NAME="android_builder_soh"
PROJECT_PATH=$(realpath "${DIR}/../../")
###############################################################################
# Check if only release build flag was provided
ONLY_RELEASE_BUILD="false"
if [[ "$1" == "--release" ]] || [[ "$1" == "-r" ]]; then
ONLY_RELEASE_BUILD="true"
fi
# Set type of build
GRADLEW_BUILD_TYPE="build"
if [[ "$ONLY_RELEASE_BUILD" == "true" ]]; then
GRADLEW_BUILD_TYPE="assembleRelease"
fi
# Header
echo ""
echo "-----------------------------------------------------------"
echo "-- Android Project Build --"
echo "-----------------------------------------------------------"
echo "Building project '${PROJECT_PATH}'..."
echo ""
# Check if the project path exists
if [ ! -d "$PROJECT_PATH" ]; then
echo "Error: Project path not found"
echo ""
exit 1
fi
# Run Container to build
docker run --network="host" --rm \
--name $CONTAINER_NAME \
-v "$PROJECT_PATH":/workspace \
-w /workspace \
$IMAGE_NAME \
bash -c "cp -a local.properties Android/ && cd Android && ./gradlew ${GRADLEW_BUILD_TYPE}"
BUILD_RESULT=$?
# Verify the result
echo ""
if [ $BUILD_RESULT -ne 0 ]; then
echo "Build Fail (error code ${BUILD_RESULT})"
exit $BUILD_RESULT
else
echo "Build success"
fi
exit 0
###############################################################################

View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
###############################################################################
# Actual script directory path
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Load Container IMAGE_NAME and IMAGE_TAG variables
source ${DIR}/set_container_vars.sh
# Setup
IMAGE_NAME="${IMAGE_NAME}:${IMAGE_TAG}"
DOCKER_FILE="Containerfile"
###############################################################################
# Build the image
echo ""
echo "-----------------------------------------------------------"
echo "-- Container Image Build --"
echo "-----------------------------------------------------------"
echo "Building '${IMAGE_NAME}'..."
docker build --network="host" -t ${IMAGE_NAME} --file $DOCKER_FILE .
build_result=$?
if [[ $build_result -ne 0 ]]; then
echo ""
echo "ERROR: Image build fail."
exit 1
fi
echo ""
echo "Image '${IMAGE_NAME}' build success."
echo ""
echo "Clean-up build cache..."
docker builder prune -f
echo "Done"
echo ""
exit 0
###############################################################################

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
###############################################################################
# Enable exit on any error
set -e
###############################################################################
# Setup Android SDK and NDK paths in project local.properties
echo "sdk.dir=${ANDROID_SDK_ROOT}" > /workspace/local.properties
echo "ndk.dir=${ANDROID_NDK_HOME}" >> /workspace/local.properties
# Execute any received command
exec "$@"
exit 0
###############################################################################

View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
###############################################################################
# Actual script directory path
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Load Container IMAGE_NAME and IMAGE_TAG variables
source ${DIR}/set_container_vars.sh
###############################################################################
# Container Pull Installation
echo ""
echo "-----------------------------------------------------------"
echo "-- Installing Container Image --"
echo "-----------------------------------------------------------"
echo "Pulling '${REGISTRY_REPO}:${IMAGE_TAG}'..."
docker pull "${REGISTRY_REPO}:${IMAGE_TAG}"
if [[ $? -ne 0 ]]; then
echo "Error: Image pull fail."
exit 1
fi
echo "Image '${REGISTRY_REPO}:${IMAGE_TAG}' installation success"
echo ""
exit 0
###############################################################################

View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
###############################################################################
# Actual script directory path
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# Load Container IMAGE_NAME and IMAGE_TAG variables
source ${DIR}/set_container_vars.sh
###############################################################################
# Header
echo ""
echo "-----------------------------------------------------------"
echo "-- Publishing Container Image --"
echo "-----------------------------------------------------------"
# Check if the image is available
if ! docker image inspect "${IMAGE_NAME}:${IMAGE_TAG}" >/dev/null 2>&1; then
echo "Error: ${IMAGE_NAME}:${IMAGE_TAG} not found."
echo "Note: The image need to be build first."
exit 1
fi
# Login to the remote registry
docker login
if [[ $? -ne 0 ]]; then
echo "Error: Login to registry fail."
exit 1
fi
# Tag Image for remote registry
docker tag "${IMAGE_NAME}:${IMAGE_TAG}" "${REGISTRY_REPO}:${IMAGE_TAG}"
# Publish the image
echo "Publishing container image ${REGISTRY_REPO}:${IMAGE_TAG} to registry..."
docker push "${REGISTRY_REPO}:${IMAGE_TAG}"
if [[ $? -ne 0 ]]; then
echo "Error: Image publish fail."
exit 1
fi
echo ""
echo "Image published successfully."
exit 0
###############################################################################

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
###############################################################################
IMAGE_NAME="android-builder-soh"
IMAGE_TAG="v1.0.0"
REGISTRY_REPO="jriosbyte/${IMAGE_NAME}"
export IMAGE_NAME IMAGE_TAG REGISTRY_REPO
###############################################################################