Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CFFP-HB
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chao Sun
CFFP-HB
Commits
41abc4d7
Commit
41abc4d7
authored
Jul 22, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
8c661d9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
Dockerfile
+23
-10
No files found.
Dockerfile
View file @
41abc4d7
...
...
@@ -8,7 +8,7 @@ ENV TZ=Asia/Shanghai
RUN
sed
-i
's/deb.debian.org/mirrors.aliyun.com/g'
/etc/apt/sources.list
&&
\
sed
-i
's/security.debian.org/mirrors.aliyun.com/g'
/etc/apt/sources.list
# 安装基础依赖
# 安装基础依赖
(包括 file 工具)
RUN
apt-get update
&&
\
apt-get install
-y
--no-install-recommends
\
libgtk-3-0
\
...
...
@@ -23,6 +23,7 @@ RUN apt-get update && \
curl
\
tar
\
ca-certificates
\
file
\
# 安装 file 命令
&& rm -rf /var/lib/apt/lists/*
# 设置工作目录
...
...
@@ -33,18 +34,30 @@ COPY . .
# 安装 HBuilderX CLI - 使用可靠下载源
RUN
mkdir
-p
/opt/HBuilderX
&&
\
# 尝试多个官方下载源
(curl -L -o /tmp/hbuilderx.tar.gz https://download.dcloud.net.cn/HBuilderX/cli/hbuilderx-linux.tar.gz || \
curl -L -o /tmp/hbuilderx.tar.gz https://download1.dcloud.net.cn/HBuilderX/cli/hbuilderx-linux.tar.gz || \
curl -L -o /tmp/hbuilderx.tar.gz https://download2.dcloud.net.cn/HBuilderX/cli/hbuilderx-linux.tar.gz) && \
# 验证文件类型
# 尝试直接下载最新版本
curl -L -o /tmp/hbuilderx.tar.gz "https://github.com/dcloudio/HBuilderX/releases/download/v3.8.7.20230901/hbuilderx-linux.tar.gz" || \
# 如果失败,尝试下载特定版本
(echo "主下载源失败,尝试备选源..." && \
curl -L -o /tmp/hbuilderx.tar.gz "https://github.com/dcloudio/HBuilderX/releases/download/3.8.4.20230719/hbuilderx-linux.tar.gz") && \
# 验证文件类型(现在有 file 命令了)
if [ "$(file -b --mime-type /tmp/hbuilderx.tar.gz)" != "application/gzip" ]; then \
echo "下载的文件不是gzip格式,使用备选方案..."; \
curl -L -o /tmp/hbuilderx.tar.gz https://github.com/dcloudio/HBuilderX/releases/download/3.8.4.20230719/hbuilderx-linux.tar.gz; \
echo "下载的文件不是gzip格式,使用本地解压验证..."; \
# 尝试解压验证内容 \
if ! tar -tzf /tmp/hbuilderx.tar.gz >/dev/null 2>&1; then \
echo "文件验证失败,使用官方CDN源..."; \
curl -L -o /tmp/hbuilderx.tar.gz "https://download.dcloud.net.cn/HBuilderX/releases/3.8.7.20230901/hbuilderx-linux.tar.gz"; \
fi \
fi && \
# 解压文件
# 解压文件
\
tar -xzvf /tmp/hbuilderx.tar.gz -C /opt/HBuilderX --strip-components=1 && \
rm -f /tmp/hbuilderx.tar.gz
rm -f /tmp/hbuilderx.tar.gz && \
# 验证安装 \
if [ ! -f "/opt/HBuilderX/cli" ]; then \
echo "HBuilderX CLI 安装失败!"; \
exit 1; \
else \
echo "HBuilderX CLI 安装成功"; \
fi
# 设置环境变量
ENV
PATH="/opt/HBuilderX:${PATH}"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment