Skip to content

Commit d704c36

Browse files
Clean up links from Docker Compose (#536)
* Clean up redundant comment * Clean up `links` from Docker Compose by calling `backend` directly instead of `host.docker.internal`. * Clean up indentation
1 parent 63311d4 commit d704c36

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

docker-compose.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@ services:
1414
- "BEHAVIORAL_TESTING"
1515
- "SIMILARITY"
1616
volumes:
17-
- ./config:/config
18-
- ./azimuth_shr:/azimuth_shr
19-
- ./cache:/cache
17+
- ./config:/config
18+
- ./azimuth_shr:/azimuth_shr
19+
- ./cache:/cache
2020
web:
2121
image: "${REGISTRY}/azimuth-app:${FRONTEND_VERSION}"
2222
command:
2323
- node
2424
- ./server.js
2525
environment:
2626
- "PORT=8080"
27+
- "REACT_APP_BACKEND_HOSTNAME=backend"
2728
ports:
2829
- "8080:8080"
29-
links:
30-
- backend:host.docker.internal

webapp/server.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,10 @@ app.use(cors(corsConfig));
2020
app.use(
2121
"/api/local",
2222
createProxyMiddleware({
23-
pathRewrite: {
24-
"^/api/[^/]+/": "/", // rewrite path
25-
},
26-
target: process.env.REACT_APP_BACKEND_PORT
27-
? `http://host.docker.internal:${process.env.REACT_APP_BACKEND_PORT}`
28-
: "http://host.docker.internal:8091",
23+
pathRewrite: { "^/api/[^/]+/": "/" },
24+
target: `http://${
25+
process.env.REACT_APP_BACKEND_HOSTNAME || "host.docker.internal"
26+
}:${process.env.REACT_APP_BACKEND_PORT || 8091}`,
2927
changeOrigin: true,
3028
})
3129
);

0 commit comments

Comments
 (0)