From 95784debbf73a366afc62f8c3f6e946c00979405 Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Thu, 7 Mar 2024 15:55:02 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=94=AF=E6=8C=81=E8=AF=86=E5=88=ABdoc?= =?UTF-8?q?ker=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 +++-- pkg/core/stages/build_app.py | 4 ++-- pkg/utils/platform.py | 4 ++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 47e4c5c..89f0950 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ COPY . . RUN apt update \ && apt install gcc -y \ - && python -m pip install -r requirements.txt - + && python -m pip install -r requirements.txt \ + && touch /.dockerenv + CMD [ "python", "main.py" ] \ No newline at end of file diff --git a/pkg/core/stages/build_app.py b/pkg/core/stages/build_app.py index a6c0fe3..24bef7c 100644 --- a/pkg/core/stages/build_app.py +++ b/pkg/core/stages/build_app.py @@ -3,7 +3,7 @@ from __future__ import annotations import sys from .. import stage, app -from ...utils import version, proxy, announce +from ...utils import version, proxy, announce, platform from ...audit.center import v2 as center_v2 from ...audit import identifier from ...pipeline import pool, controller, stagemgr @@ -39,7 +39,7 @@ class BuildAppStage(stage.BootingStage): "host_id": identifier.identifier["host_id"], "instance_id": identifier.identifier["instance_id"], "semantic_version": ver_mgr.get_current_version(), - "platform": sys.platform, + "platform": platform.get_platform(), }, runtime_info={ "admin_id": "{}".format(ap.system_cfg.data["admin-sessions"]), diff --git a/pkg/utils/platform.py b/pkg/utils/platform.py index b280b07..0d4a1f2 100644 --- a/pkg/utils/platform.py +++ b/pkg/utils/platform.py @@ -4,4 +4,8 @@ import sys def get_platform() -> str: """获取当前平台""" + # 检查是不是在 docker 里 + if os.path.exists('/.dockerenv'): + return 'docker' + return sys.platform