From 15a465c1acf4a7fe3b718ad0e5d45979e3110b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=84=E5=BB=BA=E5=9B=BD?= <9340100@qq.com> Date: Mon, 6 Jan 2025 08:03:05 +0000 Subject: [PATCH] =?UTF-8?q?=E9=9D=9E=E5=BF=85=E8=A6=81=E4=B8=8D=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=20unpkg=20=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/community/Dockerfile | 12 ++++++++++- deploy/community/docker-compose.yml | 3 --- deploy/community/fs/opt/steedos/entrypoint.sh | 6 ++++++ deploy/enterprise/docker-compose.yml | 20 ++++++++++--------- .../enterprise/fs/opt/steedos/entrypoint.sh | 8 ++++++++ .../enterprise/fs/opt/steedos/run-with-env.sh | 4 ---- 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/deploy/community/Dockerfile b/deploy/community/Dockerfile index bf2e020f2d..c6a1e4f66b 100644 --- a/deploy/community/Dockerfile +++ b/deploy/community/Dockerfile @@ -11,7 +11,17 @@ RUN apt-get update || : && apt-get install -y \ curl \ build-essential -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +# RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - + +# 安装 nvm 并安装 Node.js +ENV NVM_DIR=/root/.nvm + +RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \ + && chmod +x "$NVM_DIR/nvm.sh" \ + && bash -c ". $NVM_DIR/nvm.sh && nvm install 14.21.3 && nvm alias default 14.21.3" + +# 确保在构建过程中可用 +ENV PATH=$NVM_DIR/versions/node/v14.21.3/bin:$PATH RUN apt-get update \ && apt-get install -y gnupg curl nodejs diff --git a/deploy/community/docker-compose.yml b/deploy/community/docker-compose.yml index c3f89f319b..7bbd499ae8 100644 --- a/deploy/community/docker-compose.yml +++ b/deploy/community/docker-compose.yml @@ -14,9 +14,6 @@ services: - "9001:9001" environment: - ROOT_URL=http://127.0.0.1 - - NPM_CACHE_ENABLED=true - - NPM_CACHE_PACKAGE_CONTENT=true - - NPM_REGISTRY_URL=https://registry.npmmirror.com tty: true volumes: - "./steedos-storage:/steedos-storage" diff --git a/deploy/community/fs/opt/steedos/entrypoint.sh b/deploy/community/fs/opt/steedos/entrypoint.sh index 5060f0e785..fc11e965bd 100755 --- a/deploy/community/fs/opt/steedos/entrypoint.sh +++ b/deploy/community/fs/opt/steedos/entrypoint.sh @@ -14,6 +14,12 @@ init_env_file() { ENV_PATH="$CONF_PATH/docker.env" TEMPLATES_PATH="/opt/steedos/templates" + if [[ "${STEEDOS_UNPKG_URL}" == /unpkg* ]]; then + export STEEDOS_UNPKG_ENABLED=true + else + export STEEDOS_UNPKG_ENABLED=false + fi + mkdir -p "$CONF_PATH" # Build an env file with current env variables. We single-quote the values, as well as escaping any single-quote characters. printenv | grep -E '^STEEDOS_|^B6_|^MONGO_|ROOT_URL|CACHER|TRANSPORTER|PORT|NODE_ENV' | sed "s/'/'\\\''/g; s/=/='/; s/$/'/" > "$CONF_PATH/pre-define.env" diff --git a/deploy/enterprise/docker-compose.yml b/deploy/enterprise/docker-compose.yml index 08c048b492..fc4f7a0903 100644 --- a/deploy/enterprise/docker-compose.yml +++ b/deploy/enterprise/docker-compose.yml @@ -24,25 +24,27 @@ services: - "traefik.enable=true" - "traefik.http.routers.all.rule=PathPrefix(`/`)" - "traefik.http.services.app1.loadbalancer.server.port=80" + env_file: + - .env environment: - STEEDOS_LICENSE=6e890bc491b8c1d0edfcaa717d301478e12aa60015922ff31c55db96f74947d941a7201460baba3d9c53ffefc961a2e8e91f98db286a83f47874a004a786a40ddb52c76e6a94d328ac43fd9d338806cd5bc71ed342a90cfe42e81f557690ca653ec1d8dcb906c7e0fd344feafdf5def156242caa4f52a738d37fa52f45edfd390d3e85fb7a35d25755d980eee6164f5208a1019d616e805fad737ee9a549becd710c2e642129efd58439c90c3aa5ce3665a6503590d66505ed64b909fd95a76de9e36bf46b4ad656a896e486a773c1ea1b43108ecb5e9db77ef3a311f28753f10225cb538ba04198cbbdc74b0e5dd13ba2fe024f202d8b7d00c13d6a8363d8cc8a2bf4a79c9f8387c0ae815aa57d4df63e3194c1606df34f60abf2bdf8697da93fa27e29f1f4c193960febcf46a804ee3bbf92d98effa2e6f219e2ee503afa9dfb894aa5396a0351496a0526ec710b03bb70262123c16b23d6fa67639cd80567d1f50db0df441fa707272e6d5e4f3702b7485173702cafc81a0e2bd8aa2c9cf37ff1c3dff6738b6ed4d52b3bd24d35a9fdef2ce6109e58891e222ed712fce8b10af8883256facc8e907ba5e493b6fa47f5b00956abc53e4a63448d752bb65da619d8972a639a517b22946cf43322f3fd375d6deee8519d35265f3d9960a2668c06b5737bcc6b7b2f5a7e598ed6175a4f194637dd0c43c94a71bbe5015c8cf36c,2022-0001 - - ROOT_URL=http://127.0.0.1 + # - STEEDOS_UNPKG_URL=/unpkg - NPM_CACHE_ENABLED=true - NPM_CACHE_PACKAGE_CONTENT=true - NPM_REGISTRY_URL=https://registry.npmmirror.com - NPM_CONFIG_REGISTRY=https://registry.npmmirror.com - STEEDOS_WIDGETS_ADDITIONAL=@steedos-widgets/liveblocks@6.3.11-beta.20 # - B6_SERVER_VERSION=0.11.5 - - B6_PLUGIN_PACKAGES=@builder6/node-red@,lodash + - B6_PLUGIN_PACKAGES=@builder6/node-red,lodash - B6_PLUGIN_SERVICES=@builder6/node-red - B6_PLUGIN_MODULES=@builder6/node-red - - B6_OIDC_ENABLED=true - - B6_OIDC_ISSUER=https://id.steedos.cn/realms/master - - B6_OIDC_CLIENT_ID=steedos-oidc-public - - B6_OIDC_CLIENT_SECRET=none - - B6_OIDC_NAME=Steedos ID - - B6_OIDC_LABEL=Steedos ID - - B6_OIDC_ICON=https://www.steedos.com/favicon.png + # - B6_OIDC_ENABLED=false + # - B6_OIDC_ISSUER=https://id.steedos.cn/realms/master + # - B6_OIDC_CLIENT_ID=steedos-oidc-public + # - B6_OIDC_CLIENT_SECRET=none + # - B6_OIDC_NAME=Steedos ID + # - B6_OIDC_LABEL=Steedos ID + # - B6_OIDC_LOGO=https://www.steedos.com/favicon.png tty: true volumes: diff --git a/deploy/enterprise/fs/opt/steedos/entrypoint.sh b/deploy/enterprise/fs/opt/steedos/entrypoint.sh index f6094d696d..0536bb7d35 100755 --- a/deploy/enterprise/fs/opt/steedos/entrypoint.sh +++ b/deploy/enterprise/fs/opt/steedos/entrypoint.sh @@ -15,6 +15,14 @@ init_env_file() { TEMPLATES_PATH="/opt/steedos/templates" mkdir -p "$CONF_PATH" + + if [[ "${STEEDOS_UNPKG_URL}" == /unpkg* ]]; then + export STEEDOS_UNPKG_ENABLED=true + else + export STEEDOS_UNPKG_ENABLED=false + fi + + # Build an env file with current env variables. We single-quote the values, as well as escaping any single-quote characters. printenv | grep -E '^STEEDOS_|^B6_|^MONGO_|ROOT_URL|CACHER|TRANSPORTER|PORT|NODE_ENV' | sed "s/'/'\\\''/g; s/=/='/; s/$/'/" > "$CONF_PATH/pre-define.env" diff --git a/deploy/enterprise/fs/opt/steedos/run-with-env.sh b/deploy/enterprise/fs/opt/steedos/run-with-env.sh index ae95ad1472..7f4b5ed8ea 100755 --- a/deploy/enterprise/fs/opt/steedos/run-with-env.sh +++ b/deploy/enterprise/fs/opt/steedos/run-with-env.sh @@ -12,10 +12,6 @@ set +o allexport # export STEEDOS_UNPKG_URL=/unpkg # fi -if [[ "${STEEDOS_UNPKG_URL}" == /unpkg* ]] && [[ ! -z "${STEEDOS_LICENSE}" ]]; then - export STEEDOS_UNPKG_ENABLED=true -fi - if [[ -z "${STEEDOS_STORAGE_DIR}" ]]; then export STEEDOS_STORAGE_DIR=/steedos-storage/ fi