From 7cbc374278ce4752de2bc3d7de78ee9f2cb19447 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 5 Sep 2025 11:04:42 +0800 Subject: [PATCH] Add docker-entrypoint.sh --- .gitignore | 1 + bin/docker-entrypoint.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 bin/docker-entrypoint.sh diff --git a/.gitignore b/.gitignore index d15edf75..4bf41b55 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ packlib_files.txt /bin/* !/bin/spc* !/bin/setup-runtime* +!/bin/docker-entrypoint.sh # exclude windows build tools /php-sdk-binary-tools/ diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh new file mode 100644 index 00000000..dbe81d0f --- /dev/null +++ b/bin/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +TARGET_DIR="/app/pkgroot/$(uname -m)-linux" +BACKUP_DIR="/app/pkgroot-private" +# copy private pkgroot to pkgroot if pkgroot is empty +if [ ! -d "$TARGET_DIR" ] || [ -z "$(ls -A "$TARGET_DIR")" ]; then + echo "* Copying private pkgroot to pkgroot ..." + rm -rf "$TARGET_DIR" + cp -r "$BACKUP_DIR" "$TARGET_DIR" +fi +exec "$@"