mirror of
https://github.com/yshtcn/DiaryAssistant_bot.git
synced 2025-12-11 16:50:24 +08:00
- 修改了文件名中的空格,并修改了对应的文件
- 增加了docker打包脚本 - 增加了Dockerfile打包配置信息 -
This commit is contained in:
parent
199a5eb92a
commit
b04af3ba44
@ -105,7 +105,7 @@ rd /S /Q %~dp0\build\build
|
||||
|
||||
:: 进入打包目录并开始打包
|
||||
cd /d %~dp0\build
|
||||
pyinstaller --onefile --version-file %~dp0\version_info.txt "%~dp0\Diary Assistant.py"
|
||||
pyinstaller --onefile --version-file %~dp0\version_info.txt "%~dp0\DiaryAssistant.py"
|
||||
|
||||
::更新标题
|
||||
title "AutoPyInstaller:打包完毕,进行一些收尾工作"
|
||||
|
||||
33
Diary-Assistant_DockerBuilder.ps1
Normal file
33
Diary-Assistant_DockerBuilder.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:latest
|
||||
docker push yshtcn/diary-assistant:latest
|
||||
|
||||
pause
|
||||
@ -2,6 +2,6 @@
|
||||
cd %~dp0
|
||||
:start
|
||||
git pull
|
||||
py "Diary Assistant.py"
|
||||
py DiaryAssistant.py
|
||||
pause
|
||||
goto start
|
||||
@ -5,10 +5,11 @@ FROM python:3.11-slim
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# 将当前目录下的所有文件复制到镜像中的工作目录
|
||||
COPY . .
|
||||
COPY DiaryAssistant.py ./
|
||||
|
||||
# 创建/data目录用于存储生成的文件
|
||||
RUN mkdir /data
|
||||
|
||||
# 创建/data目录用于存储生成的文件并设置777权限
|
||||
RUN mkdir /data && chmod -R 777 /data
|
||||
|
||||
# 定义环境变量 PIP_INDEX_URL 并设置其默认值为清华大学的更新源
|
||||
ENV PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
|
||||
|
||||
18
README.md
18
README.md
@ -16,6 +16,20 @@
|
||||
|
||||
# 使用方法
|
||||
|
||||
首次运行时,会自动生成bot_config.json,并自动退出。
|
||||
## Windows版本
|
||||
|
||||
首次运行时,会自动生成bot_config.json,并自动提示按任意键退出。
|
||||
然后把你的botid填进bot_config.json,并配置好代理地址(如果不需要代理地址,直接删除代理信息即可)。
|
||||
再次启动,向你的bot发送/start看看是否可以正常运行就可以了。
|
||||
再次启动,向你的bot发送/start看看是否可以正常运行就可以了。
|
||||
|
||||
## Docker版本
|
||||
|
||||
```docker run -v /mydata:/data yshtcn/diary-assistant```
|
||||
|
||||
其中-v 是必选参数,把/mydata换成映射的目的路径,首次运行时,会自动生成bot_config.json,并自动退出。
|
||||
然后把你的botid填进映射目的地址下的bot_config.json,并配置好代理地址(如果不需要代理地址,直接删除代理信息即可)。
|
||||
再次启动,向你的bot发送/start看看是否可以正常运行就可以了。
|
||||
|
||||
可选参数:
|
||||
```-e PIP_INDEX_URL=https://pypi.official.url/simple```
|
||||
镜像默认使用清华大学的更新源,如果你需要修改使用其他地区的源可以指定。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user