mirror of
https://github.com/yshtcn/DiaryAssistant_bot.git
synced 2025-12-13 09:40:26 +08:00
- 更新打包文件
- 更新说明 - 增加Docker测试推送
This commit is contained in:
parent
7747ea4e68
commit
c9a6662ec4
33
Diary-Assistant_DockerBuilder-tagTest.ps1
Normal file
33
Diary-Assistant_DockerBuilder-tagTest.ps1
Normal file
@ -0,0 +1,33 @@
|
||||
# Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
|
||||
# 检查是否以管理员权限运行
|
||||
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
||||
# 请求管理员权限
|
||||
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
|
||||
exit
|
||||
}
|
||||
|
||||
# 更改到脚本的目录
|
||||
Set-Location $PSScriptRoot
|
||||
|
||||
|
||||
# 获取当前日期和时间
|
||||
$dateTime = Get-Date -Format "yyyyMMdd"
|
||||
|
||||
# 输出提示并获取版本的最后一位
|
||||
$revision = Read-Host -Prompt "请输入今天的版本次 ($dateTime,[?])"
|
||||
|
||||
# 构建版本号
|
||||
$version = "$dateTime" + "_$revision"
|
||||
|
||||
# 构建并打上版本号标签的 Docker 镜像
|
||||
docker build -t yshtcn/diary-assistant:$version .
|
||||
|
||||
# 推送具有版本号标签的 Docker 镜像到 Docker Hub
|
||||
docker push yshtcn/diary-assistant:$version
|
||||
|
||||
# 为镜像打上 'latest' 标签并推送
|
||||
docker tag yshtcn/diary-assistant:$version yshtcn/diary-assistant:Test
|
||||
docker push yshtcn/diary-assistant:Test
|
||||
|
||||
pause
|
||||
@ -18,4 +18,4 @@ ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
RUN pip install --no-cache-dir -i $PIP_INDEX_URL requests
|
||||
|
||||
# 设置容器启动后执行的命令
|
||||
CMD [ "python", "./Diary Assistant.py" ]
|
||||
CMD [ "python", "./DiaryAssistant.py" ]
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
|
||||
```docker run -v /mydata:/data yshtcn/diary-assistant:latest```
|
||||
|
||||
把/mydata换成映射的目的路径,首次运行时,会自动生成bot_config.json,并自动退出。
|
||||
然后把你的botid填进映射目的地址下的bot_config.json,并配置好代理地址(如果不需要代理地址,直接删除代理信息即可)。
|
||||
再次启动,向你的bot发送/start看看是否可以正常运行就可以了。
|
||||
- 把/mydata换成映射的目的路径,首次运行时,会自动生成bot_config.json,并自动退出。
|
||||
- 然后把你的botid填进映射目的地址下的bot_config.json,并配置好代理地址(如果不需要代理地址,直接删除代理信息即可)。
|
||||
- 注意,如果你无法编辑文件,可能需要给与权限:```chmod -R 777 /mydata```
|
||||
- 再次启动,向你的bot发送/start看看是否可以正常运行就可以了。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user