From 0a629bf80f4ef579970869132ba57f3b1b94db1e Mon Sep 17 00:00:00 2001 From: Dennis Postma Date: Sat, 21 Sep 2024 00:01:42 +0200 Subject: [PATCH] Added redis --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6db7c7f..b7baa97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,9 @@ # Use the official Node.js 22.4.1 image FROM node:22.4.1-alpine +# Install Redis +RUN apk add --no-cache redis + # Set the working directory in the container WORKDIR /usr/src/ @@ -22,11 +25,12 @@ COPY . . # Build the application RUN npm run build -# Expose the port your Node.js application will listen on -EXPOSE 80 +# Expose the ports your Node.js application and Redis will listen on +EXPOSE 80 6379 -# Create a shell script to run migrations and start the application +# Create a shell script to run Redis, run migrations, and start the application 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 'node dist/server.js' >> /usr/src/start.sh && \ chmod +x /usr/src/start.sh