Skip to content

Commit

Permalink
Update Dockerfile to use batch mode for Maven packaging and enhance W…
Browse files Browse the repository at this point in the history
…ebSocket URL handling for production
  • Loading branch information
athrvk committed Dec 12, 2024
1 parent fc4ccbd commit 9f3e336
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ WORKDIR /app/backend
COPY --from=frontend-build /app/frontend/build ./src/main/resources/static
COPY backend/pom.xml .
COPY backend/src ./src
RUN mvn clean package
RUN mvn -B package

# Final image
FROM openjdk:17-slim
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/utils/websocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class WebSocketService {
heartbeatOutgoing: 2000,
webSocketFactory: () => {
const isProd = process.env.NODE_ENV === 'production';
const url = `${isProd ? "https" : "http"}://localhost:8080/ws?username=${this.username}`;
const host = isProd ? window.location.hostname : 'localhost:8080';
const url = `${isProd ? "https" : "http"}://${host}/ws?username=${this.username}`;
const socket = new SockJS(url); // Update with backend URL
socket.onopen = () => console.log('SockJS connection open');
return socket;
Expand Down

0 comments on commit 9f3e336

Please sign in to comment.