Skip to content

Commit

Permalink
Merge pull request #14 from saschpe/saschpe.docker-context
Browse files Browse the repository at this point in the history
Use system-default Docker context going forward
  • Loading branch information
saschpe authored May 10, 2024
2 parents e21aff6 + 146659d commit efc4ed5
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions scripts/build
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${0}")" && pwd)
. "${SCRIPT_DIR}/inc.functions"

# Default values
BUILDX_BUILDER_NAME=main
DEFAULT_ANDROID=$(grep android= "${SCRIPT_DIR}/../Dockerfile" | cut -d"=" -f2)
DEFAULT_CMAKE=$(grep cmake= "${SCRIPT_DIR}/../Dockerfile" | cut -d"=" -f2)
DEFAULT_JDK=$(grep jdk= "${SCRIPT_DIR}/../Dockerfile" | cut -d"=" -f2)
Expand All @@ -23,7 +22,6 @@ usage() {
printf " --jdk VERSION (default: %s)\n" "${DEFAULT_JDK}"
printf " --ndk VERSION (default: %s)\n" "${DEFAULT_NDK}"
printf " --platforms (default: %s)\n" "${DEFAULT_PLATFORMS}"
printf " --clean (optional, clean up build context afterwards)\n"
printf " --push (optional, upload images to Docker Hub)\n"
exit 1
}
Expand All @@ -34,7 +32,6 @@ cmake="${DEFAULT_CMAKE}"
jdk="${DEFAULT_JDK}"
ndk="${DEFAULT_NDK}"
platforms="${DEFAULT_PLATFORMS}"
cmd_clean=
cmd_push=
while [ $# -gt 0 ]; do
key="$1"
Expand All @@ -43,9 +40,6 @@ while [ $# -gt 0 ]; do
android="$2"
shift # past argument
;;
--clean)
cmd_clean=true
;;
--cmake)
cmake="$2"
shift # past argument
Expand Down Expand Up @@ -82,21 +76,6 @@ if [ ${cmd_push} ]; then
buildx_command="--push"
fi

if [ ${cmd_clean} ]; then
cleanup() {
if docker buildx ls | grep -q ${BUILDX_BUILDER_NAME}; then
approve "Remove buildx builder '${BUILDX_BUILDER_NAME}'"
safe docker buildx rm ${BUILDX_BUILDER_NAME}
fi
}
trap cleanup EXIT
fi

if ! docker buildx ls | grep -q ${BUILDX_BUILDER_NAME}; then
approve "Create buildx builder '${BUILDX_BUILDER_NAME}'"
safe docker buildx create --name ${BUILDX_BUILDER_NAME}
fi

if [ ${cmd_push} ]; then
approve "Build and push image '${image_tag}'"
buildx_command="--push"
Expand All @@ -107,7 +86,6 @@ fi
safe docker buildx build \
--platform "${platforms}" \
${buildx_command} \
--builder ${BUILDX_BUILDER_NAME} \
--build-arg android="${android}" \
--build-arg cmake="${cmake}" \
--build-arg jdk="${jdk}" \
Expand Down

0 comments on commit efc4ed5

Please sign in to comment.