Skip to content

Commit

Permalink
Add precaution for dubious file ownership
Browse files Browse the repository at this point in the history
  • Loading branch information
YanWenKun committed Apr 11, 2024
1 parent 31f7839 commit 8adb4fa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
4 changes: 3 additions & 1 deletion megapak/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ The design of `megapak` is similar to the `latest` tag, as well as the usage. Wi

* The user within container is now 'root'.
This makes rootless deploy easier.
This makes rootless deploy on Linux easier.

For WSL2 users, recommend using a Docker volume or a WSL2 directory for file storage, rather than bind-mount a directory from Windows(NTFS) filesystem - which would perform I/O slower, and have dubious ownership.

## Usage

Expand Down
5 changes: 4 additions & 1 deletion megapak/README.zh.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@

* 容器内用户为 'root'
以便于 rootless 式部署运行。
以便于 Linux 下 rootless 式部署运行。

对于 WSL2 用户,建议使用 Docker Volume 来存储文件,或者存储到 WSL2 下的目录,这两者都是基于 WSL2 虚拟机的 ext4 虚拟硬盘,IO 性能较好。
强烈建议不要用挂载的 Windows(NTFS) 下的文件目录,一来跨文件系统互访性能很差,二来会有文件归属权混乱的问题。

## 用法

Expand Down
6 changes: 4 additions & 2 deletions megapak/runner-scripts/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ set -euo pipefail
function clone_or_pull () {
if [[ $1 =~ ^(.*[/:])(.*)(\.git)$ ]] || [[ $1 =~ ^(http.*\/)(.*)$ ]]; then
echo "${BASH_REMATCH[2]}" ;
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules "$1" \
|| git -C "${BASH_REMATCH[2]}" pull --ff-only ;
set +e ;
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules "$1" \
|| git -C "${BASH_REMATCH[2]}" pull --ff-only ;
set -e ;
else
echo "[ERROR] Invalid URL: $1" ;
return 1 ;
Expand Down
2 changes: 2 additions & 0 deletions megapak/runner-scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# Run user's set-proxy script
cd /root
if [ ! -f "/root/user-scripts/set-proxy.sh" ] ; then
mkdir -p /root/user-scripts
cp /runner-scripts/set-proxy.sh.example /root/user-scripts/set-proxy.sh
else
echo "[INFO] Running set-proxy script..."
Expand All @@ -23,6 +24,7 @@ fi ;
# Run user's pre-start script
cd /root
if [ ! -f "/root/user-scripts/pre-start.sh" ] ; then
mkdir -p /root/user-scripts
cp /runner-scripts/pre-start.sh.example /root/user-scripts/pre-start.sh
else
echo "[INFO] Running pre-start script..."
Expand Down
6 changes: 4 additions & 2 deletions rocm/runner-scripts/download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ set -euo pipefail
function clone_or_pull () {
if [[ $1 =~ ^(.*[/:])(.*)(\.git)$ ]] || [[ $1 =~ ^(http.*\/)(.*)$ ]]; then
echo "${BASH_REMATCH[2]}" ;
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules "$1" \
|| git -C "${BASH_REMATCH[2]}" pull --ff-only ;
set +e ;
git clone --depth=1 --no-tags --recurse-submodules --shallow-submodules "$1" \
|| git -C "${BASH_REMATCH[2]}" pull --ff-only ;
set -e ;
else
echo "[ERROR] Invalid URL: $1" ;
return 1 ;
Expand Down
2 changes: 2 additions & 0 deletions rocm/runner-scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
# Run user's set-proxy script
cd /root
if [ ! -f "/root/user-scripts/set-proxy.sh" ] ; then
mkdir -p /root/user-scripts
cp /runner-scripts/set-proxy.sh.example /root/user-scripts/set-proxy.sh
else
echo "[INFO] Running set-proxy script..."
Expand All @@ -23,6 +24,7 @@ fi ;
# Run user's pre-start script
cd /root
if [ ! -f "/root/user-scripts/pre-start.sh" ] ; then
mkdir -p /root/user-scripts
cp /runner-scripts/pre-start.sh.example /root/user-scripts/pre-start.sh
else
echo "[INFO] Running pre-start script..."
Expand Down

0 comments on commit 8adb4fa

Please sign in to comment.