Skip to content

Commit abe2afd

Browse files
fix: rerorder dockerfile to fix run startup (#35)
1 parent befc434 commit abe2afd

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

hypertrace-gradle-docker-java-application-plugin/CHANGELOG.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,7 @@
5151

5252
- Add support for exposing multiple docker image ports via `ports` config
5353

54-
## [0.9.7]
55-
56-
- Improve docker layering by splitting libraries into 3 layers. From the top down:
57-
- Local libraries being built as part of the target gradle build
58-
- Organization libraries that satisfy the `orgLibrarySpec` property on the `javaApplication`
59-
spec as documented in the README, but do not satisfy the local library criteria.
60-
- External libraries, presumed to be any library that does not meet the criteria of either of
61-
the above layers.
62-
- First appeared in 0.9.5, but bugs prevent correct execution until 0.9.7
54+
## [0.9.9]
55+
56+
- Fix bug introduced in 0.9.8 preventing startup. Docker laying improvements not yet working, so
57+
currently equivalent to 0.9.4

hypertrace-gradle-docker-java-application-plugin/src/main/java/org/hypertrace/gradle/docker/HypertraceDockerJavaApplicationPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void createDockerfileTask(Project project, HypertraceDockerJavaApplication javaA
112112
dockerfile.setGroup(DockerPlugin.TASK_GROUP);
113113
dockerfile.setDescription("Creates a Dockerfile for the java application");
114114
dockerfile.from(javaApplication.baseImage.map(From::new));
115-
dockerfile.copyFile(relativeScriptPath.map(relativePath -> new CopyFile(relativePath, "run")));
115+
dockerfile.workingDir("/app");
116116
dockerfile.copyFile(provideIfDirectoryExists(dockerfile.getDestDir()
117117
.map(dir -> dir.dir(DOCKER_BUILD_CONTEXT_EXTERNAL_LIBS_DIR)))
118118
.map(unused -> new CopyFile(DOCKER_BUILD_CONTEXT_EXTERNAL_LIBS_DIR, DOCKER_BUILD_CONTEXT_EXTERNAL_LIBS_DIR)));
@@ -126,12 +126,12 @@ void createDockerfileTask(Project project, HypertraceDockerJavaApplication javaA
126126
.map(dir -> dir.dir(DOCKER_BUILD_CONTEXT_RESOURCES_DIR)))
127127
.map(unused -> new CopyFile(DOCKER_BUILD_CONTEXT_RESOURCES_DIR, DOCKER_BUILD_CONTEXT_RESOURCES_DIR)));
128128
dockerfile.copyFile(new CopyFile(DOCKER_BUILD_CONTEXT_CLASSES_DIR, DOCKER_BUILD_CONTEXT_CLASSES_DIR));
129+
dockerfile.copyFile(relativeScriptPath.map(relativePath -> new CopyFile(relativePath, "run")));
129130
dockerfile.arg(COMMIT_SHA_BUILD_ARG + "=unknown");
130131
String commitShaArgReference = "${" + COMMIT_SHA_BUILD_ARG + "}";
131132
dockerfile.label(singletonMap("commit_sha", commitShaArgReference));
132133
dockerfile.environmentVariable("COMMIT_SHA", commitShaArgReference);
133134
dockerfile.label(javaApplication.maintainer.map(maintainer -> singletonMap("maintainer", maintainer)));
134-
dockerfile.workingDir("/app");
135135
dockerfile.instruction(javaApplication.healthCheck);
136136
dockerfile.environmentVariable(javaApplication.envVars);
137137
dockerfile.entryPoint("./run");

0 commit comments

Comments
 (0)