diff --git a/Diary-Assistant_DockerBuilder-tagTest.ps1 b/Diary-Assistant_DockerBuilder-tagTest.ps1 new file mode 100644 index 0000000..d008f5d --- /dev/null +++ b/Diary-Assistant_DockerBuilder-tagTest.ps1 @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5c1232f..971ac43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] diff --git a/README.md b/README.md index e74d77a..b60dc6b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ ```docker run -v /mydata:/data yshtcn/diary-assistant:latest``` -鎶/mydata鎹㈡垚鏄犲皠鐨勭洰鐨勮矾寰勶紝棣栨杩愯鏃讹紝浼氳嚜鍔ㄧ敓鎴恇ot_config.json锛屽苟鑷姩閫鍑恒 -鐒跺悗鎶婁綘鐨刡otid濉繘鏄犲皠鐩殑鍦板潃涓嬬殑bot_config.json锛屽苟閰嶇疆濂戒唬鐞嗗湴鍧锛堝鏋滀笉闇瑕佷唬鐞嗗湴鍧锛岀洿鎺ュ垹闄や唬鐞嗕俊鎭嵆鍙級銆 -鍐嶆鍚姩锛屽悜浣犵殑bot鍙戦/start鐪嬬湅鏄惁鍙互姝e父杩愯灏卞彲浠ヤ簡銆 +- 鎶/mydata鎹㈡垚鏄犲皠鐨勭洰鐨勮矾寰勶紝棣栨杩愯鏃讹紝浼氳嚜鍔ㄧ敓鎴恇ot_config.json锛屽苟鑷姩閫鍑恒 +- 鐒跺悗鎶婁綘鐨刡otid濉繘鏄犲皠鐩殑鍦板潃涓嬬殑bot_config.json锛屽苟閰嶇疆濂戒唬鐞嗗湴鍧锛堝鏋滀笉闇瑕佷唬鐞嗗湴鍧锛岀洿鎺ュ垹闄や唬鐞嗕俊鎭嵆鍙級銆 + - 娉ㄦ剰锛屽鏋滀綘鏃犳硶缂栬緫鏂囦欢锛屽彲鑳介渶瑕佺粰涓庢潈闄:```chmod -R 777 /mydata``` +- 鍐嶆鍚姩锛屽悜浣犵殑bot鍙戦/start鐪嬬湅鏄惁鍙互姝e父杩愯灏卞彲浠ヤ簡銆