Allow image application directory to be configurable
An `applicationDirectory` option on the Maven `spring-boot:build-image` goal and the Gradle `bootBuildImage` task can be configured to set the location that will be used to upload application contents to the builder image, and will contain the application contents in the generated image. Closes gh-34786
This commit is contained in:
@@ -143,8 +143,8 @@ class BootBuildImageIntegrationTests {
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage", "--pullPolicy=IF_NOT_PRESENT",
|
||||
"--imageName=example/test-image-cmd",
|
||||
"--builder=projects.registry.vmware.com/springboot/spring-boot-cnb-builder:0.0.2",
|
||||
"--runImage=projects.registry.vmware.com/springboot/run:tiny-cnb",
|
||||
"--createdDate=2020-07-01T12:34:56Z");
|
||||
"--runImage=projects.registry.vmware.com/springboot/run:tiny-cnb", "--createdDate=2020-07-01T12:34:56Z",
|
||||
"--applicationDirectory=/application");
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("example/test-image-cmd");
|
||||
assertThat(result.getOutput()).contains("---> Test Info buildpack building");
|
||||
@@ -329,6 +329,19 @@ class BootBuildImageIntegrationTests {
|
||||
removeImages(projectName);
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void buildsImageWithApplicationDirectory() throws IOException {
|
||||
writeMainClass();
|
||||
writeLongNameResource();
|
||||
BuildResult result = this.gradleBuild.build("bootBuildImage");
|
||||
String projectName = this.gradleBuild.getProjectDir().getName();
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
|
||||
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
|
||||
assertThat(result.getOutput()).contains("---> Test Info buildpack building");
|
||||
assertThat(result.getOutput()).contains("---> Test Info buildpack done");
|
||||
removeImages(projectName);
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void failsWithInvalidCreatedDate() throws IOException {
|
||||
writeMainClass();
|
||||
|
||||
Reference in New Issue
Block a user