From 99dd0bd31d7242e6bcddea0e37edaf8795711492 Mon Sep 17 00:00:00 2001 From: Jose134 Date: Wed, 22 Jan 2025 12:00:43 +0100 Subject: [PATCH] Fix deployment --- Dockerfile | 6 +++--- Jenkinsfile | 3 ++- index.html | 1 - nginx.conf | 2 +- src/components/Game.jsx | 2 +- src/components/RoomInfo.jsx | 4 ++-- src/main.jsx | 3 --- src/socket.js | 26 +++++++++++++------------- vite.config.js | 2 +- 9 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1861d40..dd29537 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,13 @@ FROM node:20-alpine as builder WORKDIR /app COPY . . -ARG VITE_APP_BACKEND_ADDRESS -ENV VITE_APP_BACKEND_ADDRESS $VITE_APP_BACKEND_ADDRESS +ARG VITE_SOCKET_URL +ENV VITE_SOCKET_URL $VITE_SOCKET_URL RUN npm install RUN npm run build FROM nginx:1.25.4-alpine-slim as prod COPY --from=builder /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d -EXPOSE 3000 +EXPOSE 5173 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile index db01716..29021f3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,13 +4,14 @@ pipeline { environment { IMAGE_NAME = "darkbird/minesweeper-frontend:latest" REGISTRY_IMAGE_NAME = "registry.xdarkbird.duckdns.org/darkbird/minesweeper-frontend:latest" + VITE_SOCKET_URL = "http://darkbird.es:5174" } stages { stage('Docker build') { steps { sh """ - docker build --build-arg VITE_SOCKET_URL=http://minesweeper-backend.darkbird.es --network="host" -t ${IMAGE_NAME} . + docker build --build-arg VITE_SOCKET_URL=${VITE_SOCKET_URL} --network="host" -t ${IMAGE_NAME} . """ } } diff --git a/index.html b/index.html index 3a66ef7..d2f22a9 100644 --- a/index.html +++ b/index.html @@ -2,7 +2,6 @@ - Minesweeper diff --git a/nginx.conf b/nginx.conf index 66f6733..a9db578 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,5 +1,5 @@ server { - listen 3000; + listen 5173; root /usr/share/nginx/html; index index.html; etag on; diff --git a/src/components/Game.jsx b/src/components/Game.jsx index 35e423c..0108db8 100644 --- a/src/components/Game.jsx +++ b/src/components/Game.jsx @@ -21,7 +21,7 @@ const Game = ({ room, playerSocketId, handleDisconnect, handleTileClick, handleS
{ - room.gameMode === 'turns' + room.gameMode === 'rounds' ?