Skip to content

Commit 7368b86

Browse files
committed
v1.9.0
1 parent 2d72307 commit 7368b86

File tree

10 files changed

+48
-20
lines changed

10 files changed

+48
-20
lines changed

app/application/http/controller/compose-container.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func (self Compose) ContainerDeploy(http *gin.Context) {
156156

157157
// 这里需要单独适配一下 php 环境的相关扩展安装
158158
// 目前只有 php 需要这样处理,暂时先直接进行判断
159-
if strings.Contains(composeRow.Setting.Store, accessor.StoreTypeOnePanel) && strings.HasSuffix(composeRow.Setting.Store, "@php") {
159+
if strings.HasPrefix(composeRow.Setting.Store, accessor.StoreTypeOnePanel) && strings.HasSuffix(composeRow.Setting.Store, "@php") {
160160
_ = docker.Sdk.NetworkConnect(docker.Sdk.Ctx, docker.NetworkItem{
161161
Name: define.DPanelProxyNetworkName,
162162
}, runCompose.ContainerList[0].Container.Names[0])

app/application/http/controller/image-tag.go

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import (
77
http2 "net/http"
88
"strings"
99

10+
"github.com/docker/docker/api/types/filters"
1011
"github.com/docker/docker/api/types/image"
12+
"github.com/docker/docker/api/types/registry"
1113
"github.com/donknap/dpanel/app/application/logic"
1214
"github.com/donknap/dpanel/common/dao"
1315
"github.com/donknap/dpanel/common/function"
@@ -202,20 +204,20 @@ func (self Image) TagPushBatch(http *gin.Context) {
202204
}
203205

204206
for _, id := range params.RegistryId {
205-
registry, _ := dao.Registry.Where(dao.Registry.ID.Eq(id)).First()
206-
if registry == nil {
207+
registryRow, err := dao.Registry.Where(dao.Registry.ID.Eq(id)).First()
208+
if err != nil || registryRow == nil {
207209
self.JsonResponseWithError(http, function.ErrorMessage(define.ErrorMessageCommonDataNotFoundOrDeleted), 500)
208210
return
209211
}
210212
password := ""
211-
if registry.Setting != nil && registry.Setting.Username != "" && registry.Setting.Password != "" {
212-
password, _ = function.AseDecode(facade.GetConfig().GetString("app.name"), registry.Setting.Password)
213+
if registryRow.Setting != nil && registryRow.Setting.Username != "" && registryRow.Setting.Password != "" {
214+
password, _ = function.AseDecode(facade.GetConfig().GetString("app.name"), registryRow.Setting.Password)
213215
}
214216

215217
registryConfig := registry2.Config{
216-
Username: registry.Setting.Username,
218+
Username: registryRow.Setting.Username,
217219
Password: password,
218-
Host: registry.ServerAddress,
220+
Host: registryRow.ServerAddress,
219221
}
220222

221223
for _, md5 := range params.Md5 {
@@ -226,7 +228,7 @@ func (self Image) TagPushBatch(http *gin.Context) {
226228
}
227229
for _, tag := range imageDetail.RepoTags {
228230
newImageName := registry2.GetImageTagDetail(tag)
229-
newImageName.Registry = registry.ServerAddress
231+
newImageName.Registry = registryRow.ServerAddress
230232
newImageName.Namespace = params.NewNamespace
231233

232234
if !function.InArray(imageDetail.RepoTags, newImageName.Uri()) {
@@ -256,3 +258,27 @@ func (self Image) TagPushBatch(http *gin.Context) {
256258
self.JsonSuccessResponse(http)
257259
return
258260
}
261+
262+
func (self Image) TagSearch(http *gin.Context) {
263+
type ParamsValidate struct {
264+
Keywork string `json:"keywork" binding:"required"`
265+
}
266+
params := ParamsValidate{}
267+
if !self.Validate(http, &params) {
268+
return
269+
}
270+
list, err := docker.Sdk.Client.ImageSearch(docker.Sdk.Ctx, params.Keywork, registry.SearchOptions{
271+
RegistryAuth: "",
272+
PrivilegeFunc: nil,
273+
Filters: filters.Args{},
274+
Limit: 0,
275+
})
276+
if err != nil {
277+
self.JsonResponseWithError(http, err, 500)
278+
return
279+
}
280+
self.JsonResponseWithoutError(http, gin.H{
281+
"list": list,
282+
})
283+
return
284+
}

app/application/logic/docker-image-task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func (self DockerTask) ImageBuild(messageId string, task accessor.ImageSettingOp
3030
builder.WithDockerFileContent([]byte(task.BuildDockerfileContent)),
3131
builder.WithGitUrl(task.BuildGit),
3232
builder.WithZipFilePath(task.BuildZip),
33-
builder.WithPlatform(task.Platform),
33+
builder.WithPlatform(task.PlatformArch),
3434
builder.WithTag(task.Tag),
3535
builder.WithArgs(task.BuildArgs...),
3636
)

app/application/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (provider *Provider) Register(httpServer *httpserver.Server) {
7676
cors.POST("/app/image/tag-delete", controller.Image{}.TagDelete)
7777
cors.POST("/app/image/tag-add", controller.Image{}.TagAdd)
7878
cors.POST("/app/image/tag-push-batch", controller.Image{}.TagPushBatch)
79+
cors.POST("/app/image/tag-search", controller.Image{}.TagSearch)
7980

8081
cors.POST("/app/image-build/create", controller.ImageBuild{}.Create)
8182
cors.POST("/app/image-build/get-list", controller.ImageBuild{}.GetList)

app/common/http/controller/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ func (self Store) Deploy(http *gin.Context) {
307307
Title: params.Title,
308308
Setting: &accessor.ComposeSettingOption{
309309
Type: accessor.ComposeTypeStore,
310-
Store: fmt.Sprintf("%s:%s@%s@%s", storeRow.Title, storeRow.Setting.Type, storeRow.Setting.Url, params.AppName),
310+
Store: fmt.Sprintf("%s:%s@%s@%s", storeRow.Setting.Type, storeRow.Title, storeRow.Setting.Url, params.AppName),
311311
Environment: params.Environment,
312312
Uri: []string{
313313
filepath.Join(params.Name, filepath.Base(params.ComposeFile)),

asset/static/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
</head>
1919
<body>
2020
<div id="root"></div>
21-
<script src="/dpanel/static/asset/umi.5009c923.js"></script>
21+
<script src="/dpanel/static/asset/umi.bb6d456c.js"></script>
2222
</body>
2323
</html>

asset/static/p__image__create.67846e0a.async.js renamed to asset/static/p__image__create.57164e06.async.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/accessor/image_setting_option.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ type ImageSettingOption struct {
1313
BuildGit string `json:"buildGit"`
1414
BuildZip string `json:"buildZip"`
1515
BuildArgs []docker.EnvItem `json:"buildArgs,omitempty"`
16-
Platform *docker.ImagePlatform `json:"platform,omitempty"`
16+
Platform string `json:"platform,omitempty"` // Deprecated: instead PlatformArch
17+
PlatformArch *docker.ImagePlatform `json:"platformArch,omitempty"`
1718
BuildDockerfile string `json:"buildDockerfile,omitempty,deprecated"` // Deprecated: instead BuildDockerfileContent
1819
BuildRoot string `json:"buildRoot,omitempty,deprecated"` // Deprecated: instead BuildDockerfileRoot
1920
}

common/service/docker/image/option.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func WithTag(name ...string) Option {
8080

8181
func WithPlatform(item *docker.ImagePlatform) Option {
8282
return func(self *Builder) error {
83-
if item.Arch == "" || item.Type == "" {
83+
if item == nil || item.Arch == "" || item.Type == "" {
8484
return nil
8585
}
8686
self.imageBuildOption.Platform = item.Type

0 commit comments

Comments
 (0)