Skip to content

Commit c0dd729

Browse files
committed
Update Dockerfile and docker-compose for stability and clarity; improve WebSocket handling in AuthContext
1 parent 479b1d6 commit c0dd729

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

docker/backend/dev.Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
FROM golang:1.23-alpine3.19 AS builder
2-
RUN mkdir /app
1+
FROM golang:1.24-alpine3.20 AS builder
2+
33
WORKDIR /app
4+
45
ENV CGO_ENABLED=1
6+
57
RUN apk update && apk add --no-cache docker-cli gcc musl-dev
6-
RUN go install github.com/air-verse/air@latest
7-
ENTRYPOINT [ "air","dev" ]
8+
9+
# Spesifik ve stabil air versiyonu kurulumu
10+
RUN go install github.com/air-verse/air@v1.62.0
11+
12+
ENTRYPOINT ["air", "dev"]

docker/dev.docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- 8080:8080
99
volumes:
1010
- ../backend:/app
11-
- /var/run/docker.sock:/var/run/docker.sock # Docker.sock ekleniyor
11+
- /var/run/docker.sock:/var/run/docker.sock
1212
networks:
1313
- codinlab
1414

@@ -38,4 +38,4 @@ services:
3838

3939
networks:
4040
codinlab:
41-
driver: bridge
41+
driver: bridge

frontend/src/context/AuthContext.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const AuthProvider = ({ children }) => {
4343
}
4444
ws.current = new WebSocket("ws://localhost/api/v1/private/socket/ws");
4545

46-
ws.current.onopen = () => {};
46+
ws.current.onopen = () => { };
4747

4848
ws.current.onmessage = (e) => {
4949
const data = JSON.parse(e.data);
@@ -144,6 +144,10 @@ const AuthProvider = ({ children }) => {
144144
};
145145

146146
const initAuth = () => {
147+
if (["/login", "/register"].includes(router.pathname)) {
148+
return;
149+
}
150+
147151
setLoading(true);
148152
setIsInitialized(false);
149153

0 commit comments

Comments
 (0)