Skip to content

Commit

Permalink
fix error on build port 80
Browse files Browse the repository at this point in the history
  • Loading branch information
pelazas committed Apr 26, 2024
1 parent a6d6788 commit 27dd23c
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion multiplayerservice/.env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
WEBAPP_ENPOINT ="http://localhost:3000"
WEBAPP_ENPOINT ="http://localhost"
2 changes: 1 addition & 1 deletion multiplayerservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion multiplayerservice/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
9 changes: 4 additions & 5 deletions webapp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 12 additions & 12 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit 27dd23c

Please sign in to comment.