From dabdfafd35b9362d7b06d622dad793594c483640 Mon Sep 17 00:00:00 2001 From: Gabriel Matte Date: Sat, 7 Dec 2024 16:40:53 -0500 Subject: [PATCH] fix quizroom docker checks --- quizRoom/Dockerfile | 13 ++++++++----- quizRoom/healthcheck.sh | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/quizRoom/Dockerfile b/quizRoom/Dockerfile index d02f5f2..03bae93 100644 --- a/quizRoom/Dockerfile +++ b/quizRoom/Dockerfile @@ -1,9 +1,8 @@ -# Use the Node base image +# Use the Node base image FROM node:18 AS quizroom -ARG PORT=4500 -ENV PORT=${PORT} -ENV ROOM_ID=${ROOM_ID} +ENV PORT=4500 +ENV ROOM_ID=000000 # Create a working directory WORKDIR /usr/src/app @@ -15,6 +14,10 @@ RUN npm install # Copy the rest of the source code to the container COPY . . +# Ensure healthcheck.sh has execution permissions +COPY healthcheck.sh /usr/src/app/healthcheck.sh +RUN chmod +x /usr/src/app/healthcheck.sh + # Build the TypeScript code RUN npm run build @@ -26,4 +29,4 @@ HEALTHCHECK --interval=30s --timeout=30s --start-period=30s --retries=3 \ CMD /usr/src/app/healthcheck.sh # Start the server using the compiled JavaScript file -CMD ["node", "dist/app.js"] +CMD ["node", "dist/app.js"] \ No newline at end of file diff --git a/quizRoom/healthcheck.sh b/quizRoom/healthcheck.sh index a3ee74d..7b0e27f 100644 --- a/quizRoom/healthcheck.sh +++ b/quizRoom/healthcheck.sh @@ -1,2 +1,2 @@ -#!/bin/sh +#!/bin/bash curl -f "http://0.0.0.0:${PORT}/health" || exit 1 \ No newline at end of file