From 448c33d842ab7a37571c6257a41ac4bcdb7b6e2b Mon Sep 17 00:00:00 2001 From: Bram Date: Mon, 8 Jun 2026 16:53:52 +0200 Subject: [PATCH] try replacing with screen --- Dockers/remote-node-container/Dockerfile | 4 +--- Dockers/remote-node-container/entrypoint.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockers/remote-node-container/Dockerfile b/Dockers/remote-node-container/Dockerfile index 517d602..6d9fb1d 100644 --- a/Dockers/remote-node-container/Dockerfile +++ b/Dockers/remote-node-container/Dockerfile @@ -4,14 +4,12 @@ FROM node:22-slim # Set the working directory WORKDIR /workspace -# Install PM2 globally -RUN npm install -g pm2 - # Install git, openssh-client, openssh-server, and other necessary packages RUN apt-get update && apt-get install -y \ git \ openssh-client \ openssh-server \ + screen \ iputils-ping \ software-properties-common \ sudo \ diff --git a/Dockers/remote-node-container/entrypoint.sh b/Dockers/remote-node-container/entrypoint.sh index b21a500..2f741cb 100644 --- a/Dockers/remote-node-container/entrypoint.sh +++ b/Dockers/remote-node-container/entrypoint.sh @@ -329,5 +329,13 @@ if [ -z "$RUN_COMMAND" ]; then fi fi -# Start the application with pm2 using the specified package manager and run command -exec pm2-runtime "$PACKAGE_MANAGER run $RUN_COMMAND" +# Start the application in a detached screen session so it can be attached interactively +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