forked from noxious/server
Add screen
This commit is contained in:
parent
70d8c43350
commit
72159cdc17
@ -1,8 +1,8 @@
|
|||||||
# Use the official Node.js 22.4.1 image
|
# Use the official Node.js 22.4.1 image
|
||||||
FROM node:22.4.1-alpine
|
FROM node:22.4.1-alpine
|
||||||
|
|
||||||
# Install Redis
|
# Install Redis and screen
|
||||||
RUN apk add --no-cache redis
|
RUN apk add --no-cache redis screen
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Set the working directory in the container
|
||||||
WORKDIR /usr/src/
|
WORKDIR /usr/src/
|
||||||
@ -28,11 +28,12 @@ RUN npm run build
|
|||||||
# Expose the ports your Node.js application and Redis will listen on
|
# Expose the ports your Node.js application and Redis will listen on
|
||||||
EXPOSE 80 6379
|
EXPOSE 80 6379
|
||||||
|
|
||||||
# Create a shell script to run Redis, run migrations, and start the application
|
# Create a shell script to run Redis, run migrations, and start the application in a screen session
|
||||||
RUN echo '#!/bin/sh' > /usr/src/start.sh && \
|
RUN echo '#!/bin/sh' > /usr/src/start.sh && \
|
||||||
echo 'redis-server --daemonize yes' >> /usr/src/start.sh && \
|
echo 'redis-server --daemonize yes' >> /usr/src/start.sh && \
|
||||||
echo 'npx prisma migrate deploy' >> /usr/src/start.sh && \
|
echo 'npx prisma migrate deploy' >> /usr/src/start.sh && \
|
||||||
echo 'node dist/server.js' >> /usr/src/start.sh && \
|
echo 'screen -dmS nodeapp node dist/server.js' >> /usr/src/start.sh && \
|
||||||
|
echo 'exec /bin/sh' >> /usr/src/start.sh && \
|
||||||
chmod +x /usr/src/start.sh
|
chmod +x /usr/src/start.sh
|
||||||
|
|
||||||
# Use the shell script as the entry point
|
# Use the shell script as the entry point
|
||||||
|
Loading…
x
Reference in New Issue
Block a user