未验证 提交 8e4aab23 编写于 作者: C colynn.liu 提交者: GitHub

Merge pull request #15 from go-atomci/feat-add-dckerfile-defined

feat: add app dockerfile path defined
......@@ -1097,7 +1097,11 @@ func (pm *PipelineManager) renderAppImageitemsForBuild(projectID, publishID, sta
}
imageURL := newImageAddr
Command := fmt.Sprintf("sh \"cd %v; export DOCKER_CONFIG=$DOCKER_CONFIG; /kaniko/executor -f Dockerfile -c ./ -d %v --insecure --skip-tls-verify --insecure-pull \"", appPath, imageURL)
dockerfile := app.Dockerfile
if dockerfile == "" {
dockerfile = "Dockerfile"
}
Command := fmt.Sprintf("sh \"cd %v; export DOCKER_CONFIG=$DOCKER_CONFIG; /kaniko/executor -f %v -c ./ -d %v --insecure --skip-tls-verify --insecure-pull \"", appPath, dockerfile, imageURL)
item.Command = Command
appImageItems = append(appImageItems, item)
}
......
......@@ -32,6 +32,10 @@ func (pm *ProjectManager) CreateProjectApp(projectID int64, item *ProjectAppReq,
// reset default value is master
item.BranchName = "master"
}
if item.Dockerfile == "" {
item.Dockerfile = "Dockerfile"
}
projectAppModel := models.ProjectApp{
Addons: models.NewAddons(),
Creator: creator,
......@@ -44,6 +48,7 @@ func (pm *ProjectManager) CreateProjectApp(projectID int64, item *ProjectAppReq,
Path: item.Path,
RepoID: item.RepoID,
BuildPath: item.BuildPath,
Dockerfile: item.Dockerfile,
}
_, err := pm.model.CreateProjectAppIfNotExist(&projectAppModel)
......@@ -129,6 +134,12 @@ func (pm *ProjectManager) UpdateProjectApp(projectID, projectAppID int64, req *P
projectApp.BuildPath = req.BuildPath
}
if req.Dockerfile == "" {
projectApp.Dockerfile = "Dockerfile"
} else {
projectApp.Dockerfile = req.Dockerfile
}
projectApp.BranchName = req.BranchName
projectApp.CompileEnvID = req.CompileEnvID
projectApp.Language = req.Language
......
......@@ -41,6 +41,7 @@ type ProjectAppUpdateReq struct {
Path string `json:"path"`
CompileEnvID int64 `json:"compile_env_id"`
BuildPath string `json:"build_path"`
Dockerfile string `json:"dockerfile"`
}
// ProjectAppBranchUpdateReq ..
......@@ -82,6 +83,7 @@ type ProjectAppReq struct {
FullName string `json:"full_name"`
BranchName string `json:"branch_name"`
BuildPath string `json:"build_path"`
Dockerfile string `json:"dockerfile"`
}
// ProjectAppRsp ..
......
......@@ -116,6 +116,7 @@ type ProjectApp struct {
RepoID int64 `orm:"column(repo_id)" json:"repo_id"`
CompileEnvID int64 `orm:"column(compile_env_id);size(64)" json:"compile_env_id"`
BuildPath string `orm:"column(build_path);size(64)" json:"build_path"`
Dockerfile string `orm:"column(dockerfile);size(256)" json:"dockerfile"`
BranchHistoryList []string `orm:"-" json:"branch_history_list"`
}
......
......@@ -24,6 +24,10 @@
<el-input v-model="form.build_path" placeholder="请输入构建目录" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="Dockerfile" prop="dockerfile">
<el-input v-model="form.dockerfile" placeholder="请输入dockerfile,默认是Dockerfile" style="width: 300px"></el-input>
</el-form-item>
<el-form-item label="编译环境" prop="compile_env_id">
<el-select v-model="form.compile_env_id" placeholder="请选择编译环境" clearable filterable style="width: 300px">
<el-option v-for="(item, index) in compileEnvs" :key="index" :label="item.name" :value="item.id">
......@@ -188,6 +192,7 @@
type: 'app',
language: 'Java',
build_path: '/',
dockerfile: 'Dockerfile'
},
getRepoLoading: true,
rules: {
......@@ -297,6 +302,7 @@
cl.language = this.form.language;
cl.type = 'app';
cl.build_path = this.form.build_path;
cl.dockerfile = this.form.dockerfile || 'Dockerfile';
cl.compile_env_id = this.form.compile_env_id || 0;
if (this.form.name !== '') {
cl.name = this.form.name
......
......@@ -12,11 +12,11 @@
</el-row>
<el-row class="mt-15">
<el-col class="w-400">开发语言:{{detailInfo.language}}</el-col>
<el-col class="w-400">默认分支: {{detailInfo.branch_name}}</el-col>
<el-col class="w-400">编译环境: {{detailInfo.compile_env != '' ? detailInfo.compile_env:'未配置'}}</el-col>
</el-row>
<el-row class="mt-15">
<el-col class="w-400">编译环境: {{detailInfo.compile_env != '' ? detailInfo.compile_env:'未配置'}}</el-col>
<el-col class="w-400">构建目录: {{detailInfo.build_path}}</el-col>
<el-col class="w-400">Dockerfile: {{detailInfo.dockerfile != '' ? detailInfo.dockerfile:'Dockerfile'}}</el-col>
</el-row>
<el-row class="mt-15">
<el-col class="w-400">创建人:{{detailInfo.creator}}</el-col>
......
......@@ -28,6 +28,9 @@
<el-form-item label="构建目录" prop="build_path">
<el-input v-model="form.build_path" placeholder="请输入构建目录"></el-input>
</el-form-item>
<el-form-item label="Dockerfile" prop="dockerfile">
<el-input v-model="form.dockerfile" placeholder="请输入Dockerfile,默认是根目录下的Dockerfile"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="doCancelCreate">{{$t('bm.other.cancel')}}</el-button>
......@@ -115,6 +118,7 @@ export default {
compile_env_id: item.compile_env_id || 0,
branch_name: item.branch_name || '',
build_path: item.build_path || '/',
dockerfile: item.dockerfile || 'Dockerfile',
branchList: item.branch_history_list || []
};
this.rowId = item.id;
......@@ -135,7 +139,8 @@ export default {
language: this.form.language,
path: this.form.path,
branch_name: this.form.branch_name,
build_path: this.form.build_path
build_path: this.form.build_path,
dockerfile: this.form.dockerfile || 'Dockerfile',
};
backend.updateAppInfo(this.$route.params.projectId, this.rowId, cl, (data) => {
successCallBack();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册