Skip to content

Commit

Permalink
Merge pull request #33 from northsea4/new_src
Browse files Browse the repository at this point in the history
New src
  • Loading branch information
northsea4 authored Dec 25, 2023
2 parents b2e4bd1 + 4a7b00a commit 71fc150
Show file tree
Hide file tree
Showing 20 changed files with 367 additions and 201 deletions.
18 changes: 9 additions & 9 deletions .env.versions
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# 本项目版本
PROJECT_VERSION=0.6.21
PROJECT_VERSION=0.7.0

#=== start === gui-base images ==========================

# `stainless403/gui-base`镜像版本
GUI_BASE_VERSION=0.3.0
GUI_BASE_VERSION=0.4.0

# `stainless403/mdcx-builtin-gui-base`镜像版本
GUI_BASE_MDCX_BUILTIN_VERSION=20231014
GUI_BASE_MDCX_BUILTIN_VERSION=120231219

# `stainless403/mdcx-src-gui-base`镜像版本
GUI_BASE_MDCX_SRC_VERSION=0.1.4
GUI_BASE_MDCX_SRC_VERSION=0.2.0

#=== end === gui-base images ==========================

Expand All @@ -21,24 +21,24 @@ GUI_BASE_MDCX_SRC_VERSION=0.1.4
WEBTOP_BASE_VERSION=0.1.2

# `stainless403/mdcx-builtin-webtop-base`镜像版本
WEBTOP_BASE_MDCX_BUILTIN_VERSION=20231014
WEBTOP_BASE_MDCX_BUILTIN_VERSION=120231219

# `stainless403/mdcx-src-webtop-base`镜像版本
WEBTOP_BASE_MDCX_SRC_VERSION=0.1.9
WEBTOP_BASE_MDCX_SRC_VERSION=0.2.0

#=== end === webtop-base images ==========================


#=== start === build-mdcx images ==========================

# `stainless403/build-mdcx-base`镜像版本
BUILD_MDCX_BASE_VERSION=0.3.0
BUILD_MDCX_BASE_VERSION=0.4.0

# `stainless403/build-mdcx`镜像版本
BUILD_MDCX_VERSION=20231014
BUILD_MDCX_VERSION=120231219

#=== end === build-mdcx images ==========================


# MDCx最新版本
MDCX_APP_VERSION=20231014
MDCX_APP_VERSION=120231219
35 changes: 19 additions & 16 deletions .github/workflows/watch-mdcx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
type: boolean

env:
RELEASE_URL: 'https://api.github.com/repos/anyabc/something/releases/latest'
RELEASE_URL: 'https://api.github.com/repos/sqzw-x/mdcx/releases/latest'
ENABLE_WATCH: ${{ secrets.ENABLE_WATCH_MDCX_RELEASE }}
GITHUB_CURRENT_REPO: ${{ github.event.repository.name }}
GITHUB_API_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
Expand Down Expand Up @@ -65,32 +65,35 @@ jobs:
# 获取最新版本信息,返回值为数组,第一个元素为版本号,第二个元素为更新时间
getNewInfo() {
local content=$(curl -s "${{ env.RELEASE_URL }}")
local asset=$(echo $content | jq '.assets'| jq 'map(select(.browser_download_url | contains("-py-")))' | jq '.[0]')
local _content=$(curl -s "${{ env.RELEASE_URL }}")
# tag名称,作为版本号
local tagName=$(printf '%s' $_content | jq -r ".tag_name")
local archiveVersion=$(echo $tagName | sed 's/v//g')
if [[ -z "$asset" ]]; then
echo "❌ 查找不到符合条件的asset!"
return 1
# 源码压缩包(tar格式)链接
local archiveUrl=$(printf '%s' $_content | jq -r ".tarball_url")
if [[ -z "$archiveUrl" ]]; then
echo "❌ 从请求结果获取源码压缩包文件下载链接失败!"
echo "🔘 请求链接:$_url"
echo "🔘 请求结果:$_content"
exit 1
fi
# https://gitbook.curiouser.top/origin/linux-jq.html#%E4%B8%89%E3%80%81jq%E5%91%BD%E4%BB%A4%E5%8F%82%E6%95%B0
# -r 如果过滤的结果是一个字符串,那么直接写到标准输出(去掉字符串的引号);
local archiveUrl=$(echo $asset | jq -r '.browser_download_url')
local updatedAt=$(echo $asset | jq -r '.updated_at')
if [[ -z "$archiveUrl" ]]; then
echo "❌ 获取下载链接失败!"
return 1
local updatedAt=$(printf '%s' $_content | jq -r '.updated_at')
# 如果没有`updated_at`,则取`published_at`
if [[ -z "$updatedAt" ]]; then
updatedAt=$(printf '%s' $_content | jq -r '.published_at')
fi
if [[ -z "$updatedAt" ]]; then
echo "❌ 获取更新时间失败!"
return 1
fi
local archiveFullName=$(echo $archiveUrl | grep -oi 'MDCx-py-[a-z0-9]\+.[a-z]\+')
local archiveVersion=$(echo $archiveFullName | sed 's/MDCx-py-//g' | sed 's/\.[^.]*$//')
local info=("$archiveVersion" "$updatedAt")
echo "${info[@]}"
return 0
Expand Down Expand Up @@ -159,7 +162,7 @@ jobs:
🎉 MDCx新版本!
📦 新版本号:${{ steps.check.outputs.newVersion }}
📅 更新时间:${{ steps.check.outputs.newTime }}
🔗 发布链接:https://github.com/anyabc/something/releases/tag/MDCx
🔗 发布链接:https://github.com/sqzw-x/mdcx/releases/tag/latest
-
name: TG Notification - For no new version
uses: appleboy/telegram-action@master
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 更新日志

### [v0.7.0] - 2023-12-24
- 1.更改上游源码项目为`sqzw-x/mdcx`#32

### [v0.6.18] - 2023-10-13
- 1.修复: `mdcx-builtin-gui-base``mdcx-builtin-gui-base`镜像内的MDCx请求某些https链接时出现`cacert.pem`错误的问题,#25

Expand Down
133 changes: 127 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,137 @@
[![GitHub stars](https://img.shields.io/github/stars/northsea4/mdcx-docker.svg?style=flat&label=Stars&maxAge=3600)](https://GitHub.com/northsea4/mdcx-docker) [![GitHub release](https://img.shields.io/github/release/northsea4/mdcx-docker.svg?style=flat&label=Release)](https://github.com/northsea4/mdcx-docker/releases/tag/latest)

⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️
👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻👇🏻

📢 上游项目(MDCx)已删库,可部署的最新版镜像为`20231014`,望悉知
📢 上游源码项目已更改为[sqzw-x/mdcx](https://github.com/sqzw-x/mdcx),请阅读下面的[更改新源码后的更新说明](https://github.com/northsea4/mdcx-docker#更改新源码后的更新说明)

⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️
👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻👆🏻

---

## 更改新源码后的更新说明
由于上游源码变更,本项目也做了相应的调整。如果需要使用`20231014`之后的版本,请参考以下说明进行更新。

### 建议的操作
直接部署新容器,然后将旧容器的配置文件等数据复制到新容器目录中。

如果想更新已有的容器,请参考下面的说明。

### builtin镜像
`mdcx-builtin-gui-base``mdcx-builtin-webtop-base`镜像。

简单来说,拉取新版镜像,然后重新部署即可。

> 注意`.env`里的`MDCX_BUILTIN_IMAGE_TAG`应该是`latest`或者最新的版本号。
> 建议先备份配置文件等数据,以免部署失败或未知问题导致数据丢失。
docker-compose方式,适用于`mdcx-builtin-gui-base``mdcx-builtin-webtop-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker-compose pull
# 重新部署
docker-compose up -d
```

docker-cli方式,适用于`mdcx-builtin-gui-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker pull stainless403/mdcx-builtin-gui-base:latest
# 停止并删除容器,容器名称请根据实际情况修改
docker stop mdcx_builtin_gui
docker rm mdcx_builtin_gui
# 重新部署,此处省略具体命令,请根据部署文档执行相关命令
docker run ...
```

docker-cli方式,适用于`mdcx-builtin-webtop-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker pull stainless403/mdcx-builtin-webtop-base:latest
# 停止并删除容器,容器名称请根据实际情况修改
docker stop mdcx_builtin_webtop
docker rm mdcx_builtin_webtop
# 重新部署,此处省略具体命令,请根据部署文档执行相关命令
docker run ...
```

### src镜像
`mdcx-src-gui-base``mdcx-src-webtop-base`镜像。

简单来说,下载新版源码,拉取新版镜像,然后重新部署即可。

> 注意`.env`里的`MDCX_BUILTIN_IMAGE_TAG`应该是`latest`或者最新的版本号。
> 建议先备份配置文件等数据,以免部署失败或未知问题导致数据丢失。
#### 下载新版源码
##### mdcx-src-gui-base
```shell
cd /path/to/mdcx-docker
# 备份旧版源码
mv app app-bak
# 下载新版`下载源码脚本`
mv update-src.sh update-src.sh-bak
curl -fsSL https://github.com/northsea4/mdcx-docker/raw/main/gui-base/update-src.sh -o update-src.sh
# 下载新版源码
bash update-src.sh --verbose
```

##### mdcx-src-webtop-base
```shell
cd /path/to/mdcx-docker
# 备份旧版源码
mv app app-bak
# 下载新版`下载源码脚本`
mv update-src.sh update-src.sh-bak
curl -fsSL https://github.com/northsea4/mdcx-docker/raw/main/webtop-base/update-src.sh -o update-src.sh
# 下载新版源码
bash update-src.sh --verbose
```

#### 重新部署
##### docker-compose方式,适用于`mdcx-src-gui-base``mdcx-src-webtop-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker-compose pull
# 重新部署
docker-compose up -d
```

##### docker-cli方式,适用于`mdcx-src-gui-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker pull stainless403/mdcx-src-gui-base:latest
# 停止并删除容器,容器名称请根据实际情况修改
docker stop mdcx_src_gui
docker rm mdcx_src_gui
# 重新部署,此处省略具体命令,请根据部署文档执行相关命令
docker run ...
```

##### docker-cli方式,适用于`mdcx-src-webtop-base`
```shell
cd /path/to/mdcx-docker
# 拉取新版镜像
docker pull stainless403/mdcx-src-webtop-base:latest
# 停止并删除容器,容器名称请根据实际情况修改
docker stop mdcx_src_webtop
docker rm mdcx_src_webtop
# 重新部署,此处省略具体命令,请根据部署文档执行相关命令
docker run ...
```

---


## 镜像
> 「builtin」表示内置已编译的应用,不需要额外下载安装包。
> ~~「src」表示使用应用的python源码运行,需要额外下载源码。~~
> 「src」表示使用应用的python源码运行,需要额外下载源码。
> 「gui」是最简单的版本,通过Web访问,且只能看到应用窗口。
> 「webtop」有比较完整的桌面环境,可以通过Web访问或RDP访问。
Expand All @@ -19,8 +140,8 @@
| --- | --- | --- | --- | --- | --- |
| [mdcx-builtin-gui-base](https://hub.docker.com/r/stainless403/mdcx-builtin-gui-base/tags) | [查看](https://github.com/northsea4/mdcx-docker/blob/main/gui-base/mdcx-builtin.md) || | | |
| [mdcx-builtin-webtop-base](https://hub.docker.com/r/stainless403/mdcx-builtin-webtop-base/tags) | [查看](https://github.com/northsea4/mdcx-docker/blob/main/webtop-base/mdcx-builtin.md) |||||
| ~~[mdcx-src-gui-base](https://hub.docker.com/r/stainless403/mdcx-src-gui-base/tags)~~ | ~~[查看](https://github.com/northsea4/mdcx-docker/blob/main/gui-base/mdcx-src.md)~~ || | | |
| ~~[mdcx-src-webtop-base](https://hub.docker.com/r/stainless403/mdcx-src-webtop-base/tags)~~ | ~~[查看](https://github.com/northsea4/mdcx-docker/blob/main/webtop-base/mdcx-src.md)~~ |||||
| [mdcx-src-gui-base](https://hub.docker.com/r/stainless403/mdcx-src-gui-base/tags) | [查看](https://github.com/northsea4/mdcx-docker/blob/main/gui-base/mdcx-src.md) || | | |
| [mdcx-src-webtop-base](https://hub.docker.com/r/stainless403/mdcx-src-webtop-base/tags) | [查看](https://github.com/northsea4/mdcx-docker/blob/main/webtop-base/mdcx-src.md) |||||


## 使用脚本部署
Expand Down
13 changes: 9 additions & 4 deletions build-mdcx/Dockerfile.build-mdcx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ RUN python3 -m pip install -r requirements.txt --verbose -i $PYPI_MIRROR
RUN pyinstaller -n MDCx \
# 图标是macOS和Windows专属
# -i Img/MDCx.ico \
-F -w MDCx_Main.py \
--add-data "Data:." \
--add-data "Img:Img" \
-F -w main.py \
-p "./src" \
# --add-data "Data:." \
# --add-data "Img:Img" \
--add-data "resources:resources" \
--add-data "libs:." \
--hidden-import socks \
--hidden-import urllib3
--hidden-import urllib3 \
--hidden-import _cffi_backend \
--collect-all curl_cffi

RUN pyinstaller MDCx.spec

Expand Down
2 changes: 1 addition & 1 deletion build-mdcx/Dockerfile.build-mdcx-base
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ RUN if [[ -n "$APT_SOURCE_HOST" ]]; then \
fi

RUN apt update -y
RUN apt install python3 python3-pip python3-pyqt5 unrar wget curl -y
RUN apt install python3 python3-pip python3-pyqt5 unrar wget curl upx-ucl -y
# RUN apt install fonts-wqy-zenhei fonts-noto-color-emoji -y


Expand Down
3 changes: 2 additions & 1 deletion gui-base/mdcx-config/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*
!.gitignore
!MDCx.config
!MDCx.config
!config.ini
Empty file added gui-base/mdcx-config/config.ini
Empty file.
4 changes: 3 additions & 1 deletion gui-base/mdcx-src.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ mkdir -p $MDCX_DOCKER_DIR && cd $MDCX_DOCKER_DIR
# 必须:相关数据或日志目录
mkdir -p app mdcx-config logs data
# 必须:配置文件目录标记文件
echo "/mdcx-config/config.ini" > mdcx-config/MDCx.config
echo "/mdcx-config/config.ini" > mdcx-config/MDCx.
# 确保有config.ini文件
touch mdcx-config/config.ini

# !!!下载源码!!!最方便的就是使用`update-src.sh`脚本,自动下载源码文件到`app`目录
./update-src.sh
Expand Down
Loading

0 comments on commit 71fc150

Please sign in to comment.