|
|
@@ -60,7 +60,7 @@ public class NodeImageBuildHandler extends AbstractHandler{
|
|
|
context.appendErrorResult(PipelineException.GIT_CLONE_ERROR,e);
|
|
|
throw new PipelineException(HttpStatus.SC_SERVICE_UNAVAILABLE, PipelineException.GIT_CLONE_ERROR,e);
|
|
|
}
|
|
|
- //2. 帮助学生创建dockerfile
|
|
|
+ //2. 帮助学生创建dockerfile和nginx配置
|
|
|
Path dockerfile = Paths.get(directory.toString(), "Dockerfile");
|
|
|
try {
|
|
|
PipelineTemplateTable.copyTemplateDockerfile(templateName,dockerfile);
|
|
|
@@ -68,6 +68,15 @@ public class NodeImageBuildHandler extends AbstractHandler{
|
|
|
context.appendErrorResult(PipelineException.DOCKERFILE_CREATE_ERROR,e);
|
|
|
throw new PipelineException(HttpStatus.SC_SERVICE_UNAVAILABLE,PipelineException.DOCKERFILE_CREATE_ERROR,e);
|
|
|
}
|
|
|
+ Path nginx = Paths.get(directory.toString(),"nginx.conf");
|
|
|
+ try {
|
|
|
+ Files.createFile(nginx);
|
|
|
+ Files.write(nginx,nginxConfig.getBytes());
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new PipelineException(HttpStatus.SC_SERVICE_UNAVAILABLE,PipelineException.NGINX_CONFIG_CREATE_ERROR,e);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//3. 镜像构建
|
|
|
String imageTag = String.valueOf(new Date().getTime());
|
|
|
StringBuilder sb = new StringBuilder();
|