From 178c7f10c2f4e8204ebb98835cc64d022c2dbe8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20M=C3=A9ndez=20Murias?= Date: Wed, 21 Feb 2024 23:00:49 +0100 Subject: [PATCH] Changes on docker-compose file --- docker-compose.yml | 12 ++++++++++++ question_generator/Dockerfile | 20 ++++++++++++++++++++ question_generator/questionService.js | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 question_generator/Dockerfile diff --git a/docker-compose.yml b/docker-compose.yml index 446657e8..2f821cb0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,6 +39,16 @@ services: environment: MONGODB_URI: mongodb://mongodb:27017/userdb + questiongenerationservice: + container_name: questiongenerationservice-${teamname:-defaultASW} + image: ghcr.io/arquisoft/wiq_es3b/questiongenerationservice:latest + profiles: ["dev", "prod"] + build: ./question_generator + ports: + - "8003:8003" + networks: + - mynetwork + gatewayservice: container_name: gatewayservice-${teamname:-defaultASW} image: ghcr.io/arquisoft/wiq_es3b/gatewayservice:latest @@ -48,6 +58,7 @@ services: - mongodb - userservice - authservice + - questiongenerationservice ports: - "8000:8000" networks: @@ -55,6 +66,7 @@ services: environment: AUTH_SERVICE_URL: http://authservice:8002 USER_SERVICE_URL: http://userservice:8001 + QUESTION_GENERATION_SERVICE_URL: http://questiongenerationservice:8003 webapp: container_name: webapp-${teamname:-defaultASW} diff --git a/question_generator/Dockerfile b/question_generator/Dockerfile new file mode 100644 index 00000000..81221b5c --- /dev/null +++ b/question_generator/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as a parent image +FROM node:20 + +# Set the working directory in the container +WORKDIR /usr/src/questionservice + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install app dependencies +RUN npm install + +# Copy the app source code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 8003 + +# Define the command to run your app +CMD ["node", "questionService.js"] diff --git a/question_generator/questionService.js b/question_generator/questionService.js index 85c6cc74..8ec72f28 100644 --- a/question_generator/questionService.js +++ b/question_generator/questionService.js @@ -6,7 +6,7 @@ const planetTemplate=require('./planets/planetsTemplates'); const generalTemplate=require('./questionTemplate') const app = express(); -const port = 8002; +const port = 8003; app.use(bodyParser.json());