This commit is contained in:
@@ -4,14 +4,12 @@ FROM node:22-slim
|
|||||||
# Set the working directory
|
# Set the working directory
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
# Install PM2 globally
|
|
||||||
RUN npm install -g pm2
|
|
||||||
|
|
||||||
# Install git, openssh-client, openssh-server, and other necessary packages
|
# Install git, openssh-client, openssh-server, and other necessary packages
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
git \
|
git \
|
||||||
openssh-client \
|
openssh-client \
|
||||||
openssh-server \
|
openssh-server \
|
||||||
|
screen \
|
||||||
iputils-ping \
|
iputils-ping \
|
||||||
software-properties-common \
|
software-properties-common \
|
||||||
sudo \
|
sudo \
|
||||||
|
|||||||
@@ -329,5 +329,13 @@ if [ -z "$RUN_COMMAND" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the application with pm2 using the specified package manager and run command
|
# Start the application in a detached screen session so it can be attached interactively
|
||||||
exec pm2-runtime "$PACKAGE_MANAGER run $RUN_COMMAND"
|
SCREEN_SESSION=${SCREEN_SESSION:-app}
|
||||||
|
|
||||||
|
screen -dmS "$SCREEN_SESSION" bash -c "$PACKAGE_MANAGER run $RUN_COMMAND; echo \"Process exited with code \$?\"; exec bash"
|
||||||
|
|
||||||
|
echo "Application started in screen session '$SCREEN_SESSION'"
|
||||||
|
echo "Attach with: screen -r $SCREEN_SESSION"
|
||||||
|
echo "Detach without stopping: Ctrl+A then D"
|
||||||
|
|
||||||
|
exec sleep infinity
|
||||||
|
|||||||
Reference in New Issue
Block a user