From 34ed2ba7cbd2d2b96eb6ade7890ac0d0aa0f44e0 Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Mon, 30 Sep 2024 21:23:38 +0200 Subject: [PATCH] TMUX? --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9bb2b2d..ab71619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # Use the official Node.js 22.4.1 image FROM node:22.4.1-alpine -# Install Redis and screen -RUN apk add --no-cache redis screen +# Install Redis and tmux +RUN apk add --no-cache redis tmux # Set the working directory in the container WORKDIR /usr/src/ @@ -28,12 +28,13 @@ RUN npm run build # Expose the ports your Node.js application and Redis will listen on EXPOSE 80 6379 -# Create a shell script to run Redis, run migrations, and start the application in a screen session +# Create a shell script to run Redis, run migrations, and start the application in a tmux session RUN echo '#!/bin/sh' > /usr/src/start.sh && \ echo 'redis-server --daemonize yes' >> /usr/src/start.sh && \ echo 'npx prisma migrate deploy' >> /usr/src/start.sh && \ - echo 'screen -dmS nodeapp node dist/server.js' >> /usr/src/start.sh && \ - echo 'exec /bin/sh' >> /usr/src/start.sh && \ + echo 'tmux new-session -d -s nodeapp "node dist/server.js"' >> /usr/src/start.sh && \ + echo 'echo "App is running in tmux session. Attach with: tmux attach-session -t nodeapp"' >> /usr/src/start.sh && \ + echo 'tail -f /dev/null' >> /usr/src/start.sh && \ chmod +x /usr/src/start.sh # Use the shell script as the entry point