Skip to content

Commit

Permalink
Merge branch 'UGREEN-DEV' into UGREEN
Browse files Browse the repository at this point in the history
2.0正式发布
  • Loading branch information
onlyLTY committed Jan 30, 2024
2 parents 2a457cb + 158e7c4 commit 4ad0d8a
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 71 deletions.
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ RUN chmod +x start.sh
# 设置环境变量
ENV secretKey="" \
hubURL="https://docker.nju.edu.cn" \
DOCKER_HOST="tcp://127.0.0.1:9375"
DOCKER_HOST="tcp://127.0.0.1:9375" \
TZ="Asia/Shanghai"

VOLUME ["/data"]
# 设置启动命令
CMD ["./start.sh"]
4 changes: 2 additions & 2 deletions dockercopilot.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ func main() {
var c config.Config
err := conf.Load(*configFile, &c, conf.UseEnv())
if err != nil {
logx.Errorf("无法加载配置文件: %v", err)
logx.Error("请重新拉取镜像")
logx.Errorf("无法加载配置文件出错: %v", err)
logx.Errorf("请确认secretKey设置正确,要求非纯数字且大于八位")
os.Exit(1)
}
server := rest.MustNewServer(c.RestConf, rest.WithCors("*"), rest.WithUnauthorizedCallback(
Expand Down
3 changes: 3 additions & 0 deletions internal/module/checkupdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func NewImageCheck() *ImageUpdateData {
}
func (i *ImageUpdateData) CheckUpdate(imageList []types.Image) {
for _, image := range imageList {
if strings.Contains(image.ImageName, "0nlylty/dockercopilot") {
continue
}
i.checkSingleImage(image)
}
}
Expand Down
41 changes: 22 additions & 19 deletions internal/utiles/updatecontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,10 @@ func UpdateContainer(ctx *svc.ServiceContext, id string, name string, imageNameA
}
timeout := 10
signal := "SIGINT"
oldTaskProgress.Message = "正在停止容器"
oldTaskProgress.Percentage = 10
oldTaskProgress.DetailMsg = "正在停止容器"
ctx.UpdateProgress(taskID, oldTaskProgress)
stopOptions := container.StopOptions{
Signal: signal,
Timeout: &timeout,
}
err = cli.ContainerStop(context.Background(), id, stopOptions)
if err != nil {
oldTaskProgress.Message = "停止容器失败"
oldTaskProgress.DetailMsg = err.Error()
oldTaskProgress.IsDone = true
ctx.UpdateProgress(taskID, oldTaskProgress)
return err
}
oldTaskProgress.Message = "容器停止成功"
oldTaskProgress.DetailMsg = "容器停止成功"
oldTaskProgress.Percentage = 20

ctx.UpdateProgress(taskID, oldTaskProgress)
oldTaskProgress.Message = "正在拉取新镜像"
oldTaskProgress.Percentage = 10
oldTaskProgress.DetailMsg = "正在拉取新镜像"
ctx.UpdateProgress(taskID, oldTaskProgress)
cli.NegotiateAPIVersion(context.TODO())
Expand Down Expand Up @@ -94,6 +77,26 @@ func UpdateContainer(ctx *svc.ServiceContext, id string, name string, imageNameA
}
oldTaskProgress.Message = "拉取镜像成功"
oldTaskProgress.DetailMsg = "拉取镜像成功"

oldTaskProgress.Percentage = 30
oldTaskProgress.Message = "正在停止容器"
oldTaskProgress.DetailMsg = "正在停止容器"
ctx.UpdateProgress(taskID, oldTaskProgress)
stopOptions := container.StopOptions{
Signal: signal,
Timeout: &timeout,
}
err = cli.ContainerStop(context.Background(), id, stopOptions)
if err != nil {
oldTaskProgress.Message = "停止容器失败"
oldTaskProgress.DetailMsg = err.Error()
oldTaskProgress.IsDone = true
ctx.UpdateProgress(taskID, oldTaskProgress)
return err
}
oldTaskProgress.Message = "容器停止成功"
oldTaskProgress.DetailMsg = "容器停止成功"

oldTaskProgress.Percentage = 40
ctx.UpdateProgress(taskID, oldTaskProgress)
oldTaskProgress.Message = "正在重命名旧容器"
Expand Down
Binary file removed static/asset/background.jpeg
Binary file not shown.
Binary file removed static/asset/wechat.jpg
Binary file not shown.
Binary file removed static/asset/zhifubao.png
Binary file not shown.
Binary file added templates/assets/alipay-TMOwxqHJ.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file added templates/assets/wechat-GYCIcvb-.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed templates/assets/wechat-pDGSdncv.jpg
Binary file not shown.
Binary file removed templates/assets/zhifubao-49yYrDNg.png
Binary file not shown.
4 changes: 2 additions & 2 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/manager/dockerCopilotLogo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>docker copilot</title>
<script type="module" crossorigin src="/manager/assets/index--Dy0IwWW.js"></script>
<link rel="stylesheet" crossorigin href="/manager/assets/index-kaKYJjmE.css">
<script type="module" crossorigin src="/manager/assets/index-AL90eS9R.js"></script>
<link rel="stylesheet" crossorigin href="/manager/assets/index--2ghzEOJ.css">
</head>
<body>
<div id="root"></div>
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.0.3-UGREEN
v2.0.0-UGREEN

0 comments on commit 4ad0d8a

Please sign in to comment.