diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 48b9bbd0f9..f9f2ffeb01 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -10,7 +10,7 @@ jobs: - "CLASSIC" - "SHANGMI" PYTHON_VERSION: - - "3.6" + - "3.11" name: "[CodeCov][${{ matrix.BKPAAS_BK_CRYPTO_TYPE }}] with Python ${{ matrix.PYTHON_VERSION }}" env: DJANGO_SETTINGS_MODULE: "settings" diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 848fef91c7..c7126cd6fd 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -12,10 +12,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up Python 3.6 + - name: Set up Python 3.11 uses: actions/setup-python@v2 with: - python-version: 3.6 + python-version: 3.11 - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/apps/backend/agent/tasks.py b/apps/backend/agent/tasks.py index e6121f87e8..1631392194 100644 --- a/apps/backend/agent/tasks.py +++ b/apps/backend/agent/tasks.py @@ -60,7 +60,7 @@ def collect_log(bk_host_id, node_id=None): else: cmd, script_type = ("cat", "sh") cmd_str = f"{cmd} {dest_dir}nm.setup_agent.{script_type}.{node_id}.debug" - script = """#!/opt/py36/bin/python + script = """#!/opt/py311/bin/python # -*- encoding:utf-8 -*- import sys import argparse diff --git a/apps/node_man/constants.py b/apps/node_man/constants.py index 5e60f61308..2bc0013c4f 100644 --- a/apps/node_man/constants.py +++ b/apps/node_man/constants.py @@ -1132,7 +1132,7 @@ class PolicyRollBackType: ] TOOLS_TO_PUSH_TO_PROXY: List[Dict[str, Union[List[str], Any]]] = [ - {"files": ["py36-x86_64.tgz", "py36-aarch64.tgz"], "name": _("检测 BT 分发策略(下发Py36包)")}, + {"files": ["py311-x86_64.tgz", "py311-aarch64.tgz"], "name": _("检测 BT 分发策略(下发Py311包)")}, { "files": [ "ntrights.exe", diff --git a/apps/node_man/periodic_tasks/update_proxy_file.py b/apps/node_man/periodic_tasks/update_proxy_file.py index 107b59c502..ebd0057c3e 100644 --- a/apps/node_man/periodic_tasks/update_proxy_file.py +++ b/apps/node_man/periodic_tasks/update_proxy_file.py @@ -152,7 +152,7 @@ def correct_file_action(download_path: str, hosts: List[Dict[str, Union[str, int return True files = [file for file in local_file__md5_map.keys()] - script = """#!/opt/py36/bin/python + script = """#!/opt/py311/bin/python # -*- encoding:utf-8 -*- import os import json diff --git a/docs/download_dir_intro.md b/docs/download_dir_intro.md index 28477b3b33..017a95d5f4 100644 --- a/docs/download_dir_intro.md +++ b/docs/download_dir_intro.md @@ -117,7 +117,8 @@ # 升级 Agent 二进制脚本(1.0 / 2.0 通用) ├── upgrade_agent.sh.tpl # Proxy 依赖包,用于 Proxy Python、Nginx 环境搭建 -├── py36.tgz +├── py311-x86_64.tgz +├── py311-aarch64.tgz ├── nginx-portable.tgz ├── start_nginx.sh.tpl # Windows Agent 安装依赖 diff --git a/docs/install/dev_deploy.md b/docs/install/dev_deploy.md index f996263c02..3228726730 100644 --- a/docs/install/dev_deploy.md +++ b/docs/install/dev_deploy.md @@ -10,28 +10,28 @@ - QQ交流群:495299374 2)如果你希望使用蓝鲸所有开源产品,进行定制开发,你可以部署开源的蓝鲸智云PaaS平台和蓝鲸智云配置平台。 -- [蓝鲸智云PaaS平台](https://github.com/Tencent/bk-PaaS) -- [蓝鲸智云配置平台](https://github.com/Tencent/bk-cmdb) +- [蓝鲸智云PaaS平台](https://github.com/Tencent/bk-PaaS) +- [蓝鲸智云配置平台](https://github.com/Tencent/bk-cmdb) 部署方法请参考各个开源产品的相关文档,在蓝鲸智云PaaS平台部署完成后,你还需要上传部署蓝鲸节点管理SaaS并开通应用免登录态验证白名单。 你可以[点击这里](https://github.com/TencentBlueKing/bk-nodeman/releases)下载蓝鲸节点管理Release版本(选择.tar.gz格式压缩包),然后前往蓝鲸PaaS平台的"开发者中心"->"S-mart应用"上传部署新应用。 你可以参考蓝鲸PaaS平台的"开发者中心"->"API网关"->"使用指南"->"API调用说明"页面中"用户认证"文档,添加默认蓝鲸节点管理APP_ID即bk_nodeman到应用免登录态验证白名单。 -## 准备本地 rabbitmq 资源 +## 准备本地 rabbitmq 资源 在本地安装 rabbitmq,并启动 rabbitmq-server,服务监听的端口保持默认(5672)。 -## 准备本地 redis 资源 +## 准备本地 redis 资源 在本地安装 redis,并启动 redis-server,服务监听的端口保持默认(6379)。 -## 准备本地 mysql +## 准备本地 mysql 在本地安装 mysql,并启动 mysql-server,服务监听的端口保持默认(3306)。 ## 安装 python 和依赖库 -在本地安装 python3.6.7 和 pip,通过 git 拉取源代码到工程目录后,并进入目录下运行 pip 命令安装 python 包。 +在本地安装 python3.11.10 和 pip,通过 git 拉取源代码到工程目录后,并进入目录下运行 pip 命令安装 python 包。 ```bash pip install -r requirements.txt ``` @@ -82,7 +82,7 @@ DATABASES = { ``` -## 创建并初始化数据库 +## 创建并初始化数据库 1) 在 mysql 中创建名为 bk_nodeman 的数据库 ```sql @@ -105,8 +105,8 @@ npm run build ``` -## 配置本地 hosts -windows: 在 C:\Windows\System32\drivers\etc\hosts 文件中添加“127.0.0.1 dev.{BK_PAAS_HOST}”。 +## 配置本地 hosts +windows: 在 C:\Windows\System32\drivers\etc\hosts 文件中添加“127.0.0.1 dev.{BK_PAAS_HOST}”。 mac: 执行 “sudo vim /etc/hosts”,添加“127.0.0.1 dev.{BK_PAAS_HOST}”。 @@ -117,5 +117,5 @@ python manage.py runserver 8000 ``` -## 访问页面 +## 访问页面 使用浏览器开发 http://dev.{BK_PAAS_HOST}:8000/ 访问应用。 diff --git a/docs/install_channel.md b/docs/install_channel.md index 0722e2b6a0..9fec5127a7 100644 --- a/docs/install_channel.md +++ b/docs/install_channel.md @@ -34,9 +34,9 @@ echo ${nginx_dns_list[@]} ``` * 根据不同的网络场景,酌情选择以下对应的配置模板 - * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的端口监听配置是不同的,配置项 `listen` 需要根据实际情况进行配置 - * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的上游地址配置方式是不同的,配置项 `upstream` 中的上游地址 `proxy` 需要根据上游实际地址进行配置, -如果上游地址为``ipv6``主机时,以下模板二中的``upstream proxy`` 配置项请调整为 `[::ip]:17981;`,其中`::ip` 代表实际的 `ipv6` 地址 + * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的端口监听配置是不同的,配置项 `listen` 需要根据实际情况进行配置 + * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的上游地址配置方式是不同的,配置项 `upstream` 中的上游地址 `proxy` 需要根据上游实际地址进行配置, +如果上游地址为``ipv6``主机时,以下模板二中的``upstream proxy`` 配置项请调整为 `[::ip]:17981;`,其中`::ip` 代表实际的 `ipv6` 地址 * 模板一: 常规通道主机`nginx`配置模板 ```nginx events { @@ -98,8 +98,8 @@ } } upstream proxy { - server 10.0.0.1:17981; - server 10.0.0.2:17981; + server 10.0.0.1:17981; + server 10.0.0.2:17981; } server { listen 17981; @@ -147,7 +147,8 @@ ├── libcurl-x64.dll ├── nginx-portable.tgz ├── ntrights.exe - ├── py36.tgz + ├── py311-x86_64.tgz + ├── py311-aarch64.tgz ├── setup_agent.bat ├── setup_agent.ksh ├── setup_agent.sh @@ -158,8 +159,8 @@ ├── tcping.exe └── unixdate.exe ``` - -7. 解压下载目录中的 ``py36.tgz`` 到 `/opt` 目录 + +7. 解压下载目录中的 ``py311-$(arch).tgz`` 到 `/opt` 目录 ```bash - tar xvf /data/bkee/public/bknodeman/download/py36.tgz -C /opt + tar xvf /data/bkee/public/bknodeman/download/py311-$(arch).tgz -C /opt ``` \ No newline at end of file diff --git a/frontend/static/doc/install_channel_en.md b/frontend/static/doc/install_channel_en.md index 25d39dfb8a..991152d5b9 100644 --- a/frontend/static/doc/install_channel_en.md +++ b/frontend/static/doc/install_channel_en.md @@ -97,8 +97,8 @@ If the upstream address is an ``ipv6`` host, please adjust the ``upstream proxy` } } upstream proxy { - server 10.0.0.1:17981; - server 10.0.0.2:17981; + server 10.0.0.1:17981; + server 10.0.0.2:17981; } server { listen 17981; @@ -146,7 +146,8 @@ If the upstream address is an ``ipv6`` host, please adjust the ``upstream proxy` ├── libcurl-x64.dll ├── nginx-portable.tgz ├── ntrights.exe - ├── py36.tgz + ├── py311-x86_64.tgz + ├── py311-aarch64.tgz ├── setup_agent.bat ├── setup_agent.ksh ├── setup_agent.sh @@ -157,8 +158,8 @@ If the upstream address is an ``ipv6`` host, please adjust the ``upstream proxy` ├── tcping.exe └── unixdate.exe ``` - -7. Unzip ``py36.tgz`` in the download directory to the `/opt` directory + +7. Unzip ``py311-$(arch).tgz`` in the download directory to the `/opt` directory ```bash - tar xvf /data/bkee/public/bknodeman/download/py36.tgz -C /opt + tar xvf /data/bkee/public/bknodeman/download/py311-$(arch).tgz -C /opt ``` \ No newline at end of file diff --git a/frontend/static/doc/install_channel_zh.md b/frontend/static/doc/install_channel_zh.md index 0722e2b6a0..9fec5127a7 100644 --- a/frontend/static/doc/install_channel_zh.md +++ b/frontend/static/doc/install_channel_zh.md @@ -34,9 +34,9 @@ echo ${nginx_dns_list[@]} ``` * 根据不同的网络场景,酌情选择以下对应的配置模板 - * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的端口监听配置是不同的,配置项 `listen` 需要根据实际情况进行配置 - * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的上游地址配置方式是不同的,配置项 `upstream` 中的上游地址 `proxy` 需要根据上游实际地址进行配置, -如果上游地址为``ipv6``主机时,以下模板二中的``upstream proxy`` 配置项请调整为 `[::ip]:17981;`,其中`::ip` 代表实际的 `ipv6` 地址 + * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的端口监听配置是不同的,配置项 `listen` 需要根据实际情况进行配置 + * 请注意: `nginx` 对于 ``ipv4`` 与 ``ipv6`` 的上游地址配置方式是不同的,配置项 `upstream` 中的上游地址 `proxy` 需要根据上游实际地址进行配置, +如果上游地址为``ipv6``主机时,以下模板二中的``upstream proxy`` 配置项请调整为 `[::ip]:17981;`,其中`::ip` 代表实际的 `ipv6` 地址 * 模板一: 常规通道主机`nginx`配置模板 ```nginx events { @@ -98,8 +98,8 @@ } } upstream proxy { - server 10.0.0.1:17981; - server 10.0.0.2:17981; + server 10.0.0.1:17981; + server 10.0.0.2:17981; } server { listen 17981; @@ -147,7 +147,8 @@ ├── libcurl-x64.dll ├── nginx-portable.tgz ├── ntrights.exe - ├── py36.tgz + ├── py311-x86_64.tgz + ├── py311-aarch64.tgz ├── setup_agent.bat ├── setup_agent.ksh ├── setup_agent.sh @@ -158,8 +159,8 @@ ├── tcping.exe └── unixdate.exe ``` - -7. 解压下载目录中的 ``py36.tgz`` 到 `/opt` 目录 + +7. 解压下载目录中的 ``py311-$(arch).tgz`` 到 `/opt` 目录 ```bash - tar xvf /data/bkee/public/bknodeman/download/py36.tgz -C /opt + tar xvf /data/bkee/public/bknodeman/download/py311-$(arch).tgz -C /opt ``` \ No newline at end of file diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 892d490197..a30aff3794 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -3416,8 +3416,8 @@ msgid "IPv6" msgstr "IPv6" #: apps/node_man/constants.py:1026 -msgid "检测 BT 分发策略(下发Py36包)" -msgstr "Detect BT distribution strategy (distribute Py36 package)" +msgid "检测 BT 分发策略(下发Py311包)" +msgstr "Detect BT distribution strategy (distribute Py311 package)" #: apps/node_man/constants.py:1040 msgid "下发安装工具" diff --git a/pack.sh b/pack.sh index 6dba31913f..6b2f194db6 100755 --- a/pack.sh +++ b/pack.sh @@ -96,7 +96,7 @@ cat > ${CODE_DIST_DIR}/projects.yaml << EOF project_dir: bknodeman/nodeman alias: nodeman version_type: ee - language: python/3.6 + language: python/3.11 version: ${RELEASE_VERSION} EOF diff --git a/runtime.txt b/runtime.txt index 1935e9778d..e345195560 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.6.6 +python-3.11.10 diff --git a/script_tools/py36-x86_64.tgz b/script_tools/py311-aarch64.tgz similarity index 79% rename from script_tools/py36-x86_64.tgz rename to script_tools/py311-aarch64.tgz index 390243dd10..37a10477ef 100644 Binary files a/script_tools/py36-x86_64.tgz and b/script_tools/py311-aarch64.tgz differ diff --git a/script_tools/py311-x86_64.tgz b/script_tools/py311-x86_64.tgz new file mode 100644 index 0000000000..b4d5a8f708 Binary files /dev/null and b/script_tools/py311-x86_64.tgz differ diff --git a/script_tools/py36-aarch64.tgz b/script_tools/py36-aarch64.tgz deleted file mode 100644 index be591d600b..0000000000 Binary files a/script_tools/py36-aarch64.tgz and /dev/null differ diff --git a/script_tools/setup_pagent.py b/script_tools/setup_pagent.py index c4031683ef..ddd6df1dc3 100644 --- a/script_tools/setup_pagent.py +++ b/script_tools/setup_pagent.py @@ -1,4 +1,4 @@ -#!/opt/py36/bin/python +#!/opt/py311/bin/python # -*- encoding:utf-8 -*- # vim:ft=python sts=4 sw=4 expandtab nu diff --git a/script_tools/setup_proxy.sh b/script_tools/setup_proxy.sh index 1a3ec146eb..a1d9602c10 100755 --- a/script_tools/setup_proxy.sh +++ b/script_tools/setup_proxy.sh @@ -535,7 +535,7 @@ setup_proxy () { fi done - # setup_py36 + # setup_py311 # create dir mkdir -p "$GSE_AGENT_RUN_DIR" "$GSE_AGENT_DATA_DIR" "$GSE_AGENT_LOG_DIR" @@ -547,10 +547,10 @@ setup_proxy () { log setup_proxy DONE "gse proxy setup successfully" } -setup_py36 () { +setup_py311 () { ( - # 默认带好requirements, 直接解压即可, 固定目录/opt/py36/bin/python。不需要走pip install - cd /opt && tar xf "$TMP_DIR/py36.tgz" + # 默认带好requirements, 直接解压即可, 固定目录/opt/py311/bin/python。不需要走pip install + cd /opt && tar xf "$TMP_DIR/py311-$(arch).tgz" ) } @@ -560,7 +560,7 @@ download_pkg () { log download_pkg START "download gse agent package from $DOWNLOAD_URL/$PKG_NAME)." cd "$TMP_DIR" && rm -f "$PKG_NAME" {agent,btsvr,transit,opts,data,dataflow}.conf."$LAN_ETH_IP" - # 安装Proxy,需要下载py36.tgz + # 安装Proxy,需要下载py311-$(arch).tgz # 该包中包含impackt,ssh2-python, proxy.py 等安装p-agent所需的模块 for f in $PKG_NAME; do http_status=$(http_proxy=$HTTP_PROXY https_proxy=$HTTPS_PROXY curl -o "$TMP_DIR/$f" \ diff --git a/script_tools/start_nginx.sh.tpl b/script_tools/start_nginx.sh.tpl index bf36307e26..072d22ed60 100644 --- a/script_tools/start_nginx.sh.tpl +++ b/script_tools/start_nginx.sh.tpl @@ -16,9 +16,9 @@ get_cpu_arch "uname -p" || get_cpu_arch "uname -m" || fail get_cpu_arch "Failed /opt/nginx-portable/nginx-portable stop || :; rm -rf /opt/nginx-portable/; -rm -rf /opt/py36/; +rm -rf /opt/py311/; -tar xvf %(nginx_path)s/py36-${CPU_ARCH}.tgz -C /opt; +tar xvf %(nginx_path)s/py311-${CPU_ARCH}.tgz -C /opt; tar xvf %(nginx_path)s/nginx-portable-${CPU_ARCH}.tgz -C /opt; timeout 120 chmod -R 755 %(nginx_path)s || echo "chmod directory %(nginx_path)s failed" diff --git a/scripts/workflows/prepare_services.sh b/scripts/workflows/prepare_services.sh index 337c455204..35454f226a 100755 --- a/scripts/workflows/prepare_services.sh +++ b/scripts/workflows/prepare_services.sh @@ -11,7 +11,7 @@ if [ "$CREATE_PYTHON_VENV" ]; then pip install virtualenv VENV_DIR="${APP_CODE}_venv" virtualenv "$VENV_DIR" - virtualenv -p /usr/local/bin/python3.6 "$VENV_DIR" + virtualenv -p /usr/local/bin/python3.11 "$VENV_DIR" # 激活Python虚拟环境 source "${VENV_DIR}/bin/activate" fi diff --git a/support-files/images/python/py311/Dockerfile b/support-files/images/python/py311/Dockerfile new file mode 100644 index 0000000000..b53e860d68 --- /dev/null +++ b/support-files/images/python/py311/Dockerfile @@ -0,0 +1,58 @@ +FROM centos:7 + +ARG ROOT_PATH=/root/python +ARG OPENSSL_VERSION=1.1.1v +ARG PYTHON_VERSION=3.11.10 +ARG PYTHON_DIR=/opt/py311 +ARG PKG_PATH=/tmp/py311.tgz + +RUN mkdir -p ${ROOT_PATH} ${PYTHON_DIR} +WORKDIR ${ROOT_PATH} + +RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \ + -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.cloud.tencent.com|g' \ + -i.bak \ + /etc/yum.repos.d/CentOS-*.repo && yum makecache + +RUN yum install -y gcc automake autoconf libtool make glibc-static centos-release-scl + +RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \ + -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.cloud.tencent.com|g' \ + -i.bak \ + /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo && sed -e 's|^mirrorlist=|#mirrorlist=|g' \ + -e 's|^# baseurl=http://mirror.centos.org|baseurl=https://mirrors.cloud.tencent.com|g' \ + -i.bak \ + /etc/yum.repos.d/CentOS-SCLo-scl.repo && yum makecache + +RUN yum install -y devtoolset-7 wget perl perl-devel zlib-devel bzip2-devel readline-devel sqlite-devel snappy-devel xz-devel libffi-devel ncurses-devel gdbm-devel tk-devel xz-devel + +RUN echo "source /opt/rh/devtoolset-7/enable" >> /etc/bashrc && source /opt/rh/devtoolset-7/enable + +RUN wget --no-check-certificate https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz + +RUN wget --no-check-certificate https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz + +RUN tar -zxvf openssl-${OPENSSL_VERSION}.tar.gz + +RUN cd openssl-${OPENSSL_VERSION} && ./config -fPIC no-shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl + +RUN cd openssl-${OPENSSL_VERSION} && make -j4 && make install + +RUN tar xvf Python-${PYTHON_VERSION}.tgz +RUN cd Python-${PYTHON_VERSION} && printf 'SSL=/usr/local/ssl\n_ssl _ssl.c \\\n -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \\\n -L$(SSL)/lib -l:libssl.a -l:libcrypto.a\n' > Modules/Setup.local + +RUN cd Python-${PYTHON_VERSION} && ./configure --prefix=${PYTHON_DIR} --disable-shared --enable-optimizations --enable-option-checking=fatal +RUN cd Python-${PYTHON_VERSION} && make build_all -j4 && make install +RUN mkdir /root/.pip/ && touch /root/.pip/pip.conf +RUN sed '4d' /root/.pip/pip.conf > /root/.pip/pip.conf + +COPY requirements.txt ${ROOT_PATH}/requirements.txt + +RUN ${PYTHON_DIR}/bin/pip3 install --upgrade pip==24.3.1 -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com +RUN ${PYTHON_DIR}/bin/pip3 install -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com pbr==6.1.0 +RUN ${PYTHON_DIR}/bin/pip3 install -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com -r requirements.txt + +RUN cd ${PYTHON_DIR}/bin && ln -sf python3 python && ln -sf pip3 pip +RUN cd ${PYTHON_DIR} && find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete +RUN rm -rf ${PYTHON_DIR}/lib/python3.11/site-packages/impacket/examples +RUN tar czvf ${PKG_PATH} -C /opt py311 \ No newline at end of file diff --git a/support-files/images/python/py36/README.md b/support-files/images/python/py311/README.md similarity index 68% rename from support-files/images/python/py36/README.md rename to support-files/images/python/py311/README.md index 5b289ca3f6..624ab97dc2 100644 --- a/support-files/images/python/py36/README.md +++ b/support-files/images/python/py311/README.md @@ -1,4 +1,4 @@ -## PYTHON 3.6 编译 +## PYTHON 3.11 编译 此文档用于介绍如何编译节点管理``Proxy``服务器上部署的``python``服务二进制 ### 前置步骤 @@ -8,16 +8,16 @@ 1. 同步``Dockerfile`` 2. 编译并复制 ```bash -docker build -t python36:latest . +docker build -t python311:latest . # 检查编译步骤无误后 -docker_id=$(docker run -d $(docker build -t python36:latest -q .) bash -c "while true; do echo hello world; sleep 1; done") -docker cp $docker_id:/tmp/py36.tgz py36.tgz +docker_id=$(docker run -d $(docker build -t python311:latest -q .) bash -c "while true; do echo hello world; sleep 1; done") +docker cp $docker_id:/tmp/py311.tgz py311-$(arch).tgz ``` 3. 停止容器 ```bash docker stop $docker_id ``` -### py36.tgz 替换 -替换路径 `/data/bkee/public/bknodeman/download` 中的文件`py36.tgz` +### py311.tgz 替换 +替换路径 `/data/bkee/public/bknodeman/download` 中的文件`py311.tgz` diff --git a/support-files/images/python/py311/requirements.txt b/support-files/images/python/py311/requirements.txt new file mode 100644 index 0000000000..831869da45 --- /dev/null +++ b/support-files/images/python/py311/requirements.txt @@ -0,0 +1,14 @@ +paramiko==3.4.0 +requests==2.31.0 +impacket==0.11.0 +psutil==5.7.0 +PyMySQL==1.1.1 +supervisor==4.2.2 +setuptools==65.5.0 +six==1.17.0 +stevedore==3.2.2 +virtualenv==20.28.0 +virtualenv-clone==0.5.7 +virtualenvwrapper==6.1.1 +typing-extensions==4.12.2 +zipp==3.21.0 \ No newline at end of file diff --git a/support-files/images/python/py36/Dockerfile b/support-files/images/python/py36/Dockerfile deleted file mode 100644 index 78c02fd098..0000000000 --- a/support-files/images/python/py36/Dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -FROM centos:7 - -ARG ROOT_PATH=/root/python -ARG OPENSSL_VERSION=1.1.1v -ARG PYTHON_VERSION=3.6.13 -ARG PYTHON_DIR=/opt/py36 -ARG PKG_PATH=/tmp/py36.tgz - -RUN mkdir -p ${ROOT_PATH} ${PYTHON_DIR} -WORKDIR ${ROOT_PATH} - -RUN sed -e 's|^mirrorlist=|#mirrorlist=|g' \ - -e 's|^#baseurl=http://mirror.centos.org|baseurl=https://mirrors.cloud.tencent.com|g' \ - -i.bak \ - /etc/yum.repos.d/CentOS-*.repo && yum makecache - -RUN yum -y install gcc automake autoconf libtool make - -RUN yum install -y wget perl perl-devel zlib-devel bzip2-devel readline-devel sqlite-devel snappy-devel xz-devel - -RUN wget --no-check-certificate https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz - -RUN wget --no-check-certificate https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz - -RUN tar -zxvf openssl-${OPENSSL_VERSION}.tar.gz - -RUN cd openssl-${OPENSSL_VERSION} && ./config shared --prefix=${PYTHON_DIR} --openssldir=${PYTHON_DIR}/openssl - -RUN cd openssl-${OPENSSL_VERSION} && make && make install - -ENV LDFLAGS "-L${PYTHON_DIR}/lib/ -L${PYTHON_DIR}/lib64/ -Wl,-rpath=${PYTHON_DIR}/lib/:${PYTHON_DIR}/lib64/" -ENV LD_LIBRARY_PATH "${PYTHON_DIR}/lib/:${PYTHON_DIR}/lib64/" -ENV CPPFLAGS "-I${PYTHON_DIR}/include -I${PYTHON_DIR}/include/openssl" - -RUN mkdir Modules -RUN echo ' SSL=/usr/local/ssl _ssl _ssl.c -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl -L$(SSL)/lib -lssl -lcrypto ' >> Modules/Setup.dist - -RUN tar xvf Python-${PYTHON_VERSION}.tgz -RUN cd Python-${PYTHON_VERSION} && ./configure --prefix=${PYTHON_DIR} --enable-optimizations --enable-option-checking=fatal -RUN cd Python-${PYTHON_VERSION} && make build_all && make install -RUN mkdir /root/.pip/ && touch /root/.pip/pip.conf -RUN sed '4d' /root/.pip/pip.conf > /root/.pip/pip.conf - -RUN touch requirements.txt -RUN echo paramiko==2.9.1 >> requirements.txt -RUN echo requests==2.20.0 >> requirements.txt -RUN echo impacket==0.9.22 >> requirements.txt -RUN echo psutil==5.7.0 >> requirements.txt -RUN echo PyMySQL==0.6.7 >> requirements.txt -RUN echo supervisor==4.2.1 >> requirements.txt -RUN echo setuptools==40.6.2 >> requirements.txt -RUN echo six==1.15.0 >> requirements.txt -RUN echo stevedore==3.2.2 >> requirements.txt -RUN echo virtualenv==20.1.0 >> requirements.txt -RUN echo virtualenv-clone==0.5.4 >> requirements.txt -RUN echo virtualenvwrapper==4.8.4 >> requirements.txt -RUN echo typing-extensions==3.7.4.3 >> requirements.txt -RUN echo zipp==3.2.0 >> requirements.txt - -RUN ${PYTHON_DIR}/bin/pip3 install --upgrade pip==20.2.3 -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com -RUN ${PYTHON_DIR}/bin/pip3 install -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com pbr==5.5.1 -RUN ${PYTHON_DIR}/bin/pip3 install -i https://mirrors.tencent.com/pypi/simple/ --trusted-host mirrors.tencent.com -r requirements.txt - -RUN cd ${PYTHON_DIR}/bin && ln -sf python3 python && ln -sf pip3 pip -RUN tar czvf ${PKG_PATH} -C /opt py36 \ No newline at end of file