From 0ae9b76f04001a2af990dda804f28fc2cffba894 Mon Sep 17 00:00:00 2001 From: fit2bot <68588906+fit2bot@users.noreply.github.com> Date: Fri, 9 Dec 2022 10:21:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA=20?= =?UTF-8?q?(#9179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * perf: 优化构建 * fix: 修正构建错误 * perf: 优化构建依赖包 * fix: 修正构建判断 * perf: 现阶段还需要 debug 工具 Co-authored-by: 吴小白 <296015668@qq.com> --- Dockerfile | 16 ++++++---------- Dockerfile-ee | 10 ++++++++++ Dockerfile.loong64 | 18 +++++++----------- requirements/requirements.txt | 24 +----------------------- requirements/requirements_xpack.txt | 24 ++++++++++++++++++++++++ 5 files changed, 48 insertions(+), 44 deletions(-) create mode 100644 Dockerfile-ee create mode 100644 requirements/requirements_xpack.txt diff --git a/Dockerfile b/Dockerfile index f236c86eb..9bb5f2f8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,6 @@ ARG BUILD_DEPENDENCIES=" \ pkg-config" ARG DEPENDENCIES=" \ - default-libmysqlclient-dev \ freetds-dev \ libpq-dev \ libffi-dev \ @@ -28,20 +27,15 @@ ARG DEPENDENCIES=" \ libxml2-dev \ libxmlsec1-dev \ libxmlsec1-openssl \ - libaio-dev \ - openssh-client \ - sshpass" + libaio-dev" ARG TOOLS=" \ ca-certificates \ - curl \ - default-mysql-client \ - iputils-ping \ + default-libmysqlclient-dev \ locales \ - procps \ - redis-tools \ + openssh-client \ + sshpass \ telnet \ - vim \ unzip \ wget" @@ -82,6 +76,8 @@ ENV PIP_MIRROR=$PIP_MIRROR ARG PIP_JMS_MIRROR=https://pypi.douban.com/simple ENV PIP_JMS_MIRROR=$PIP_JMS_MIRROR +ARG DEBUG + RUN --mount=type=cache,target=/root/.cache/pip \ set -ex \ && pip config set global.index-url ${PIP_MIRROR} \ diff --git a/Dockerfile-ee b/Dockerfile-ee new file mode 100644 index 000000000..63c65d21c --- /dev/null +++ b/Dockerfile-ee @@ -0,0 +1,10 @@ +ARG VERSION +FROM registry.fit2cloud.com/jumpserver/xpack:${VERSION} as build-xpack +FROM jumpserver/core:${VERSION} +COPY --from=build-xpack /opt/xpack /opt/jumpserver/apps/xpack + +WORKDIR /opt/jumpserver + +RUN --mount=type=cache,target=/root/.cache/pip \ + set -ex \ + && pip install -r requirements/requirements_xpack.txt diff --git a/Dockerfile.loong64 b/Dockerfile.loong64 index c2fa521b6..6a1d9a2f1 100644 --- a/Dockerfile.loong64 +++ b/Dockerfile.loong64 @@ -18,7 +18,6 @@ ARG BUILD_DEPENDENCIES=" \ pkg-config" ARG DEPENDENCIES=" \ - default-libmysqlclient-dev \ freetds-dev \ libpq-dev \ libffi-dev \ @@ -28,20 +27,15 @@ ARG DEPENDENCIES=" \ libxml2-dev \ libxmlsec1-dev \ libxmlsec1-openssl \ - libaio-dev \ - openssh-client \ - sshpass" + libaio-dev" ARG TOOLS=" \ ca-certificates \ - curl \ - default-mysql-client \ - iputils-ping \ + default-libmysqlclient-dev \ locales \ - netcat \ - redis-server \ + openssh-client \ + sshpass \ telnet \ - vim \ unzip \ wget" @@ -69,12 +63,14 @@ ENV PIP_MIRROR=$PIP_MIRROR ARG PIP_JMS_MIRROR=https://pypi.douban.com/simple ENV PIP_JMS_MIRROR=$PIP_JMS_MIRROR +ARG DEBUG + RUN --mount=type=cache,target=/root/.cache/pip \ set -ex \ && pip config set global.index-url ${PIP_MIRROR} \ && pip install --upgrade pip \ && pip install --upgrade setuptools wheel \ - && pip install https://download.jumpserver.org/pypi/simple/cryptography/cryptography-36.0.1-cp38-cp38-linux_loongarch64.whl \ + && pip install https://download.jumpserver.org/pypi/simple/cryptography/cryptography-36.0.2-cp38-cp38-linux_loongarch64.whl \ && pip install https://download.jumpserver.org/pypi/simple/greenlet/greenlet-1.1.2-cp38-cp38-linux_loongarch64.whl \ && pip install $(grep 'PyNaCl' requirements/requirements.txt) \ && GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true pip install grpcio \ diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5baa5b953..33494d442 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -25,7 +25,7 @@ paramiko==2.11.0 passlib==1.7.4 pyasn1==0.4.8 pycparser==2.21 -cryptography==37.0.4 +cryptography==36.0.2 pycryptodome==3.15.0 pycryptodomex==3.15.0 gmssl==3.2.1 @@ -87,7 +87,6 @@ pytz==2022.1 # Runtime django-proxy==1.2.1 channels-redis==3.4.0 -channels==3.0.4 python-daemon==2.3.0 eventlet==0.33.1 greenlet==1.1.2 @@ -107,23 +106,6 @@ django-cas-ng==4.0.1 python-cas==1.5.0 django-auth-ldap==2.2.0 # Cloud req -qingcloud-sdk==1.2.12 -azure-mgmt-subscription==1.0.0 -azure-identity==1.5.0 -azure-mgmt-compute==4.6.2 -azure-mgmt-network==2.7.0 -google-cloud-compute==0.5.0 -alibabacloud_dysmsapi20170525==2.0.2 -python-novaclient==11.0.1 -python-keystoneclient==4.3.0 -bce-python-sdk==0.8.64 -tencentcloud-sdk-python==3.0.662 -aliyun-python-sdk-core-v3==2.9.1 -aliyun-python-sdk-ecs==4.10.1 -huaweicloud-sdk-python==1.0.21 -# python-keystoneclient need keystoneauth1>=3.4.0 -# huaweicloud-sdk-python need keystoneauth1<=3.4.0 -keystoneauth1==3.4.0 boto3==1.24.12 botocore==1.27.12 s3transfer==0.6.0 @@ -131,8 +113,6 @@ kubernetes==21.7.0 # DB requirements mysqlclient==2.1.0 PyMySQL==1.0.2 -oracledb==1.0.1 -psycopg2-binary==2.9.1 pymssql==2.2.5 django-mysql==3.9.0 django-redis==5.2.0 @@ -146,5 +126,3 @@ ipython==8.4.0 ForgeryPy3==0.3.1 django-debug-toolbar==3.5 Pympler==1.0.1 -IPy==1.1 -psycopg2==2.9.4 diff --git a/requirements/requirements_xpack.txt b/requirements/requirements_xpack.txt new file mode 100644 index 000000000..4f0f0ea7d --- /dev/null +++ b/requirements/requirements_xpack.txt @@ -0,0 +1,24 @@ +# Cloud req +qingcloud-sdk==1.2.12 +azure-mgmt-subscription==1.0.0 +azure-identity==1.5.0 +azure-mgmt-compute==4.6.2 +azure-mgmt-network==2.7.0 +google-cloud-compute==0.5.0 +alibabacloud_dysmsapi20170525==2.0.2 +python-novaclient==11.0.1 +python-keystoneclient==4.3.0 +bce-python-sdk==0.8.64 +tencentcloud-sdk-python==3.0.662 +aliyun-python-sdk-core-v3==2.9.1 +aliyun-python-sdk-ecs==4.10.1 +huaweicloud-sdk-python==1.0.21 +# python-keystoneclient need keystoneauth1>=3.4.0 +# huaweicloud-sdk-python need keystoneauth1<=3.4.0 +keystoneauth1==3.4.0 +# DB requirements +oracledb==1.0.1 +psycopg2-binary==2.9.1 +pymssql==2.2.5 +IPy==1.1 +psycopg2==2.9.4