From 5286cb0e807809a171dc173fd0356edd9f15c8fe Mon Sep 17 00:00:00 2001 From: fanfpy Date: Tue, 22 Jul 2025 18:04:11 +0800 Subject: [PATCH] =?UTF-8?q?refactor(docker):=20=E6=9B=B4=E6=96=B0Python?= =?UTF-8?q?=E5=9F=BA=E7=A1=80=E9=95=9C=E5=83=8F=E8=87=B33.11-slim-bullseye?= =?UTF-8?q?=20refactor(consul):=20=E7=BB=9F=E4=B8=80=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BD=BF=E7=94=A8=E6=9C=8D=E5=8A=A1=E5=90=8D?= =?UTF-8?q?=E5=92=8C=E6=A0=87=E5=87=86=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新Dockerfile中的Python基础镜像版本以使用更稳定的3.11版本 修改consul配置文件中服务检查地址和端口,使用服务名替代IP地址并统一端口号 --- consul/config/dev/data-service.json | 4 ++-- consul/config/dev/emotion-service.json | 4 ++-- consul/config/dev/frontend.json | 4 ++-- consul/config/dev/quant-service.json | 4 ++-- consul/config/dev/recommend-service.json | 4 ++-- consul/config/dev/user-service.json | 4 ++-- services/emotion-service/Dockerfile | 2 +- services/quant-service/Dockerfile | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/consul/config/dev/data-service.json b/consul/config/dev/data-service.json index df2bc95..c2a790f 100644 --- a/consul/config/dev/data-service.json +++ b/consul/config/dev/data-service.json @@ -2,7 +2,7 @@ "service": { "address": "data-service", "check": { - "http": "http://10.195.102.127:18000/api/public/stock_bid_ask_em?symbol=000001", + "http": "http://data-service:8000/api/public/stock_bid_ask_em?symbol=000001", "interval": "10s", "timeout": "5s" }, @@ -16,6 +16,6 @@ "traefik.http.routers.data-service.middlewares=data-service-stripprefix@consulcatalog" ], "name": "data-service", - "port": 18000 + "port": 8000 } } \ No newline at end of file diff --git a/consul/config/dev/emotion-service.json b/consul/config/dev/emotion-service.json index 524c5fb..9494079 100644 --- a/consul/config/dev/emotion-service.json +++ b/consul/config/dev/emotion-service.json @@ -2,7 +2,7 @@ "service": { "address": "emotion-service", "check": { - "http": "http://10.195.102.127:18002/health", + "http": "http://emotion-service:8002/health", "interval": "10s", "timeout": "5s" }, @@ -15,6 +15,6 @@ "traefik.http.routers.emotion-service.middlewares=emotion-service-stripprefix@consulcatalog" ], "name": "emotion-service", - "port": 18002 + "port": 8002 } } \ No newline at end of file diff --git a/consul/config/dev/frontend.json b/consul/config/dev/frontend.json index 4b80dad..f288fbc 100644 --- a/consul/config/dev/frontend.json +++ b/consul/config/dev/frontend.json @@ -2,7 +2,7 @@ "service": { "address": "frontend", "check": { - "http": "http://10.195.102.127:180/", + "http": "http://frontend/", "interval": "10s", "timeout": "5s" }, @@ -14,6 +14,6 @@ "traefik.http.routers.frontend.entrypoints=web" ], "name": "frontend", - "port": 180 + "port": 80 } } \ No newline at end of file diff --git a/consul/config/dev/quant-service.json b/consul/config/dev/quant-service.json index 9e483ef..c049613 100644 --- a/consul/config/dev/quant-service.json +++ b/consul/config/dev/quant-service.json @@ -2,7 +2,7 @@ "service": { "address": "quant-service", "check": { - "http": "http://10.195.102.127:18001/health", + "http": "http://quant-service:8001/health", "interval": "10s", "timeout": "5s" }, @@ -15,6 +15,6 @@ "traefik.http.routers.quant-service.middlewares=quant-service-stripprefix@consulcatalog" ], "name": "quant-service", - "port": 18001 + "port": 8001 } } \ No newline at end of file diff --git a/consul/config/dev/recommend-service.json b/consul/config/dev/recommend-service.json index 32efb08..bcc2851 100644 --- a/consul/config/dev/recommend-service.json +++ b/consul/config/dev/recommend-service.json @@ -2,7 +2,7 @@ "service": { "address": "recommend-service", "check": { - "http": "http://10.195.102.127:18003/health", + "http": "http://user-service:8003/health", "interval": "10s", "timeout": "5s" }, @@ -15,6 +15,6 @@ "traefik.http.routers.recommend-service.middlewares=recommend-service-stripprefix@consulcatalog" ], "name": "recommend-service", - "port": 18003 + "port": 8003 } } \ No newline at end of file diff --git a/consul/config/dev/user-service.json b/consul/config/dev/user-service.json index 4327c82..3bc7c0a 100644 --- a/consul/config/dev/user-service.json +++ b/consul/config/dev/user-service.json @@ -2,7 +2,7 @@ "service": { "address": "user-service", "check": { - "http": "http://10.195.102.127:18004/health", + "http": "http://user-service:8004/health", "interval": "10s", "timeout": "5s" }, @@ -15,6 +15,6 @@ "traefik.http.routers.user-service.middlewares=user-service-stripprefix@consulcatalog" ], "name": "user-service", - "port": 18004 + "port": 8004 } } \ No newline at end of file diff --git a/services/emotion-service/Dockerfile b/services/emotion-service/Dockerfile index f5f0e88..d32daf2 100644 --- a/services/emotion-service/Dockerfile +++ b/services/emotion-service/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.11-slim-bullseye WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt diff --git a/services/quant-service/Dockerfile b/services/quant-service/Dockerfile index a7914a6..bda6e82 100644 --- a/services/quant-service/Dockerfile +++ b/services/quant-service/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-slim +FROM python:3.11-slim-bullseye WORKDIR /app COPY requirements.txt . RUN pip install -r requirements.txt