From 27dd23cd6d8160ea528b53500b6938ecfa925b3d Mon Sep 17 00:00:00 2001 From: carlospelazas Date: Fri, 26 Apr 2024 14:08:42 +0200 Subject: [PATCH] fix error on build port 80 --- multiplayerservice/.env | 2 +- multiplayerservice/Dockerfile | 2 +- multiplayerservice/server.js | 4 +++- webapp/Dockerfile | 9 ++++----- webapp/package-lock.json | 24 ++++++++++++------------ webapp/package.json | 4 ++-- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/multiplayerservice/.env b/multiplayerservice/.env index 436771d..db79b38 100644 --- a/multiplayerservice/.env +++ b/multiplayerservice/.env @@ -1 +1 @@ -WEBAPP_ENPOINT ="http://localhost:3000" \ No newline at end of file +WEBAPP_ENPOINT ="http://localhost" \ No newline at end of file diff --git a/multiplayerservice/Dockerfile b/multiplayerservice/Dockerfile index 809cbfc..70a6b33 100644 --- a/multiplayerservice/Dockerfile +++ b/multiplayerservice/Dockerfile @@ -10,7 +10,7 @@ COPY package*.json ./ # Install app dependencies RUN npm install -ARG WEBAPP_URI="http://localhost:3000" +ARG WEBAPP_URI="http://localhost:80" ENV WEBAPP_ENDPOINT=$WEBAPP_URI # Copy the app source code to the working directory diff --git a/multiplayerservice/server.js b/multiplayerservice/server.js index 6b8d6a5..d2b8c85 100644 --- a/multiplayerservice/server.js +++ b/multiplayerservice/server.js @@ -9,11 +9,13 @@ require('dotenv').config(); const io = socketIo(server, { cors: { //origin: 'http://conoceryvencer.xyz', - origin: process.env.WEBAPP_ENPOINT || 'http://localhost:3000', + origin: process.env.WEBAPP_ENPOINT || 'http://localhost', methods: ['GET', 'POST'], credentials: true } }); + +console.log(process.env.WEBAPP_ENPOINT) const parties = {}; const lobby = {}; diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 767c4b2..4014be4 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -6,19 +6,18 @@ WORKDIR /app #Install the dependencies RUN npm install - -ARG API_URI="https://localhost:8000" +ARG API_URI="http://localhost:8000" ENV REACT_APP_API_ENDPOINT=$API_URI -ARG MULTIPLAYER_URI="http://conoceryvencer.xyz:8006" -ENV MULTIPLAYER_URI=$MULTIPLAYER_URI +ARG MULTIPLAYER_URI="http://localhost:8006" +ENV REACT_APP_MULTIPLAYER_ENDPOINT=$MULTIPLAYER_URI #Create an optimized version of the webapp RUN npm run build RUN npm install serve #Execute npm run prod to run the server -CMD [ "npm", "run", "prod" ] +CMD [ "npm", "run", "prod"] #CMD ["npm", "start"] USER node \ No newline at end of file diff --git a/webapp/package-lock.json b/webapp/package-lock.json index d883b5c..5d8a00d 100644 --- a/webapp/package-lock.json +++ b/webapp/package-lock.json @@ -41,7 +41,7 @@ "puppeteer": "^2.1.1", "react-i18next": "^11.6.0", "sass": "^1.71.1", - "serve": "^14.2.1", + "serve": "^14.2.3", "start-server-and-test": "^2.0.3", "typescript": "^4.9.5" } @@ -5785,9 +5785,9 @@ "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" }, "node_modules/@zeit/schemas": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz", - "integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==", + "version": "2.36.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", + "integrity": "sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==", "dev": true }, "node_modules/abab": { @@ -21429,13 +21429,13 @@ } }, "node_modules/serve": { - "version": "14.2.1", - "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.1.tgz", - "integrity": "sha512-48er5fzHh7GCShLnNyPBRPEjs2I6QBozeGr02gaacROiyS/8ARADlj595j39iZXAqBbJHH/ivJJyPRWY9sQWZA==", + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.3.tgz", + "integrity": "sha512-VqUFMC7K3LDGeGnJM9h56D3XGKb6KGgOw0cVNtA26yYXHCcpxf3xwCTUaQoWlVS7i8Jdh3GjQkOB23qsXyjoyQ==", "dev": true, "dependencies": { - "@zeit/schemas": "2.29.0", - "ajv": "8.11.0", + "@zeit/schemas": "2.36.0", + "ajv": "8.12.0", "arg": "5.0.2", "boxen": "7.0.0", "chalk": "5.0.1", @@ -21599,9 +21599,9 @@ } }, "node_modules/serve/node_modules/ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", - "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "version": "8.12.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.12.0.tgz", + "integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", diff --git a/webapp/package.json b/webapp/package.json index da9d588..6169d2d 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -27,7 +27,7 @@ "scripts": { "start": "react-scripts start", "build": "react-scripts build", - "prod": "cross-env REACT_APP_API_ENDPOINT=http://conoceryvencer.xyz:8000 REACT_APP_MULTIPLAYER_ENDPOINT=http://conoceryvencer.xyz:8006 serve -s build", + "prod": "cross-env REACT_APP_API_ENDPOINT=http://localhost:8000 serve -s build -l 80", "test": "react-scripts test --transformIgnorePatterns 'node_modules/(?!axios)/'", "test:e2e": "start-server-and-test 'node e2e/test-environment-setup.js' http://localhost:8000/health prod 3000 \"cd e2e && jest\"", "eject": "react-scripts eject", @@ -63,7 +63,7 @@ "puppeteer": "^2.1.1", "react-i18next": "^11.6.0", "sass": "^1.71.1", - "serve": "^14.2.1", + "serve": "^14.2.3", "start-server-and-test": "^2.0.3", "typescript": "^4.9.5" }