Skip to content

fix: arguments arrays preservation on Launcher entrypoint - #69

Open
FarhanMS123 wants to merge 1 commit into
Atinoda:masterfrom
FarhanMS123:patch-1
Open

fix: arguments arrays preservation on Launcher entrypoint#69
FarhanMS123 wants to merge 1 commit into
Atinoda:masterfrom
FarhanMS123:patch-1

Conversation

@FarhanMS123

Copy link
Copy Markdown

I actually questioning why you really need this entrypoint with its complex args passing mechanism. My issue is cannot run this container with custom command where I need to mount to user data for persistent files. The original entrypoint is not allowed me to even use /bin/bash -c "echo something > /tmp/test.txt" and just output empty while, with no file created, but exit 0.

I assume this entrypoint would allow you (creator) to do some warm up to the system (by using entrypoint), while separate the application calling (using CMD), and let user to redefine textgen parameters (using env EXTRA_LAUNCH_ARGS). So, here some proof of concept I done.

For more context, I try to run this image in RunPod where I can't change the entrypoint. I need to do the if workspace empty, then copy the user data. Symlink the workspace into the userdata every startup.

I just make a simple ./launcher.sh with chmod +x.

#!/bin/bash

eval "extra_launch_args=($EXTRA_LAUNCH_ARGS)"
LAUNCHER=("$@" "${extra_launch_args[@]}")

echo $LAUNCHER
echo "$LAUNCHER"
echo "${LAUNCHER[@]}"
exec "${LAUNCHER[@]}"

The objective:

export EXTRA_LAUNCH_ARGS="--listen --api --verbose"
./launcher.sh python3 /app/server.py

Simple test: ./test.sh:

#!/bin/bash

echo "$@"
echo "$*"
echo "$#"

I run:

export EXTRA_LAUNCH_ARGS='-c "echo hello $SHELL world" --listen --api'
./launcher.sh /bin/bash ./test.sh

Output:

/bin/bash
/bin/bash
/bin/bash ./c.sh -c echo hello /usr/bin/zsh world --listen --api
-c echo hello /usr/bin/zsh world --listen --api
-c echo hello /usr/bin/zsh world --listen --api
4

I run:

export EXTRA_LAUNCH_ARGS='-c "echo hello $SHELL world"'
./launcher.sh /bin/bash

Output:

/bin/bash
/bin/bash
/bin/bash -c echo hello /usr/bin/zsh world
hello /usr/bin/zsh world

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant