Skip to content

Commit

Permalink
Restore "resources" layer (micronaut-projects#939)
Browse files Browse the repository at this point in the history
This layer is actually required for regular docker images (no optimized/AOT) since
the jars which are included are not the regular jars.

Fixes micronaut-projects#938
  • Loading branch information
melix authored and rorueda committed Feb 6, 2024
1 parent 19471a7 commit 864a926
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public void apply(Project project) {
layer.getLayerKind().set(LayerKind.APP);
layer.getFiles().from(runnerJar);
});
image.addLayer(layer -> {
layer.getLayerKind().set(LayerKind.EXPANDED_RESOURCES);
layer.getFiles().from(project.getExtensions().getByType(SourceSetContainer.class)
.getByName(SourceSet.MAIN_SOURCE_SET_NAME).getOutput().getResourcesDir());
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public enum LayerKind {
PROJECT_LIBS("project_libs", "libs"),
SNAPSHOT_LIBS("snapshot_libs", "libs"),
LIBS("libs", "libs"),
APP("app", "");
APP("app", ""),
EXPANDED_RESOURCES("resources", "resources");

private final String sourceDirName;
private final String targetDirName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class Application {
WORKDIR /home/alternate
COPY --link layers/libs /home/alternate/libs
COPY --link layers/app /home/alternate/
COPY --link layers/resources /home/alternate/resources
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/home/alternate/application.jar"]
"""
Expand Down Expand Up @@ -252,6 +253,7 @@ class Application {
WORKDIR /home/app
COPY layers/libs /home/app/libs
COPY layers/app /home/app/
COPY layers/resources /home/app/resources
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ FROM ghcr.io/graalvm/native-image-community:17-ol${DefaultVersions.ORACLELINUX}
WORKDIR /home/alternate
COPY --link layers/libs /home/alternate/libs
COPY --link layers/app /home/alternate/
COPY --link layers/resources /home/alternate/resources
RUN mkdir /home/alternate/config-dirs
RUN mkdir -p /home/alternate/config-dirs/generateResourcesConfigFile
RUN mkdir -p /home/alternate/config-dirs/io.netty/netty-common/4.0.0.Final
Expand Down Expand Up @@ -692,6 +693,7 @@ WORKDIR /home/app
COPY --link layers/libs /home/app/libs
COPY --link server.iprof /home/app/server.iprof
COPY --link layers/app /home/app/
COPY --link layers/resources /home/app/resources
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
"""
Expand All @@ -706,6 +708,7 @@ WORKDIR /home/app
COPY --link layers/libs /home/app/libs
COPY --link server.iprof /home/app/server.iprof
COPY --link layers/app /home/app/
COPY --link layers/resources /home/app/resources
RUN mkdir /home/app/config-dirs
RUN mkdir -p /home/app/config-dirs/generateResourcesConfigFile
COPY --link config-dirs/generateResourcesConfigFile /home/app/config-dirs/generateResourcesConfigFile
Expand Down Expand Up @@ -768,6 +771,7 @@ WORKDIR /home/app
COPY --link layers/libs /home/app/libs
COPY --link server.iprof /home/app/server.iprof
COPY --link layers/app /home/app/
COPY --link layers/resources /home/app/resources
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/home/app/application.jar"]
"""
Expand Down

0 comments on commit 864a926

Please sign in to comment.