Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions agent/app/dto/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type ImageBuild struct {
Name string `json:"name" validate:"required"`
Dockerfile string `json:"dockerfile" validate:"required"`
Tags []string `json:"tags"`
Args []string `json:"args"`
}

type ImagePull struct {
Expand Down
10 changes: 10 additions & 0 deletions agent/app/service/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,16 @@ func stringsToMap(list []string) map[string]string {
}
return labelMap
}
func stringsToMap2(list []string) map[string]*string {
var labelMap = make(map[string]*string)
for _, label := range list {
if strings.Contains(label, "=") {
sps := strings.SplitN(label, "=", 2)
labelMap[sps[0]] = &sps[1]
}
}
return labelMap
}

func calculateCPUPercentUnix(stats *container.StatsResponse) float64 {
cpuPercent := 0.0
Expand Down
1 change: 1 addition & 0 deletions agent/app/service/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ func (u *ImageService) ImageBuild(req dto.ImageBuild) error {
Tags: []string{req.Name},
Remove: true,
Labels: stringsToMap(req.Tags),
BuildArgs: stringsToMap2(req.Args),
}
taskItem, err := task.NewTaskWithOps(req.Name, task.TaskBuild, task.TaskScopeImage, req.TaskID, 1)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/interface/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export namespace Container {
name: string;
dockerfile: string;
tags: Array<string>;
args: Array<string>;
}
export interface ImagePull {
taskID: string;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ const message = {
pull: 'Pull',
path: 'Path',
importImage: 'Import',
build: 'Build',
buildArgs: 'Build Arguments',
imageBuild: 'Build',
pathSelect: 'Path',
label: 'Label',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/es-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ const message = {
pull: 'Descargar',
path: 'Ruta',
importImage: 'Importar',
build: 'Construir',
buildArgs: 'Argumentos de Construcción',
imageBuild: 'Construir',
pathSelect: 'Ruta',
label: 'Etiqueta',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ const message = {
pull: '引く',
path: 'パス',
importImage: '輸入',
build: '建てる',
buildArgs: 'ビルド引数',
imageBuild: '建てる',
pathSelect: 'パス',
label: 'ラベル',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ const message = {
pull: '풀',
path: '경로',
importImage: '가져오기',
build: '빌드',
buildArgs: '빌드 인수',
imageBuild: '이미지 빌드',
pathSelect: '경로',
label: '레이블',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/ms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ const message = {
pull: 'Tarik',
path: 'Laluan',
importImage: 'Import',
build: 'Bina',
buildArgs: 'Argumen Binaan',
imageBuild: 'Bina',
pathSelect: 'Laluan',
label: 'Label',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/pt-br.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ const message = {
pull: 'Puxar',
path: 'Caminho',
importImage: 'Importar',
build: 'Construir',
buildArgs: 'Argumentos de Build',
imageBuild: 'Construção de imagem',
pathSelect: 'Caminho',
label: 'Etiqueta',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ const message = {
pull: 'Загрузить',
path: 'Путь',
importImage: 'Импорт',
build: 'Сборка',
buildArgs: 'Аргументы Сборки',
imageBuild: 'Сборка',
pathSelect: 'Путь',
label: 'Метка',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ const message = {
pull: 'Çek',
path: 'Yol',
importImage: 'İçe aktar',
build: 'Oluştur',
buildArgs: 'Derleme Argümanları',
imageBuild: 'Oluştur',
pathSelect: 'Yol',
label: 'Etiket',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/zh-Hant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ const message = {
path: '路徑',
importImage: '匯入鏡像',
imageBuild: '構建鏡像',
build: '構建鏡像',
buildArgs: '構建參數',
pathSelect: '路徑選擇',
label: '標籤',
imageTag: '鏡像標籤',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lang/modules/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ const message = {
path: '路径',
importImage: '导入镜像',
imageBuild: '构建镜像',
build: '构建镜像',
buildArgs: '构建参数',
pathSelect: '路径选择',
label: '标签',
imageTag: '镜像标签',
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/views/container/image/build/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
</template>
</el-input>
</el-form-item>
<el-form-item :label="$t('container.buildArgs')">
<el-input :placeholder="$t('container.tagHelper')" type="textarea" :rows="3" v-model="form.argStr" />
</el-form-item>
<el-form-item :label="$t('container.tag')">
<el-input :placeholder="$t('container.tagHelper')" type="textarea" :rows="3" v-model="form.tagStr" />
</el-form-item>
Expand Down Expand Up @@ -71,6 +74,8 @@ const form = reactive({
name: '',
tagStr: '',
tags: [] as Array<string>,
argStr: '',
args: [] as Array<string>,
});

const rules = reactive({
Expand All @@ -83,6 +88,7 @@ const acceptParams = async () => {
form.from = 'path';
form.dockerfile = '';
form.tagStr = '';
form.argStr = '';
form.name = '';
};
const emit = defineEmits<{ (e: 'search'): void }>();
Expand All @@ -102,6 +108,9 @@ const onSubmit = async (formEl: FormInstance | undefined) => {
if (form.tagStr !== '') {
form.tags = form.tagStr.split('\n');
}
if (form.argStr !== '') {
form.args = form.argStr.split('\n');
}
form.taskID = newUUID();
await imageBuild(form);
openTaskLog(form.taskID);
Expand Down
Loading