Skip to content

Commit

Permalink
feat(docker): add App CDS for Docker image (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
joschi authored Mar 7, 2024
1 parent f2702ff commit e689558
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/
target/
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ RUN ./mvnw -V -B -ff -P docker package -q

FROM eclipse-temurin:21-jre-alpine
WORKDIR /app
COPY --from=build /build/cli/target/openapi-diff-cli-*-all.jar /app/openapi-diff.jar
ENTRYPOINT ["java", "-jar", "/app/openapi-diff.jar"]
COPY --from=build /build/cli/target/openapi-diff.jar /app/openapi-diff.jar
COPY --from=build /build/core/src/test/resources/petstore_v2_* /tmp
RUN java -XX:ArchiveClassesAtExit=/app/appcds.jsa \
-jar /app/openapi-diff.jar \
/tmp/petstore_v2_1.yaml \
/tmp/petstore_v2_2.yaml \
&& rm -f /tmp/petstore_v2_*
ENTRYPOINT ["java", "-Xshare:on", "-XX:SharedArchiveFile=/app/appcds.jsa", "-jar", "/app/openapi-diff.jar"]
CMD ["--help"]
40 changes: 39 additions & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
<name>openapi-diff-cli</name>
<description>CLI for openapi-diff</description>

<properties>
<mainClass>org.openapitools.openapidiff.cli.Main</mainClass>
</properties>

<dependencies>
<dependency>
<groupId>org.openapitools.openapidiff</groupId>
Expand Down Expand Up @@ -52,7 +56,7 @@
<shadedClassifierName>all</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openapitools.openapidiff.cli.Main</mainClass>
<mainClass>${mainClass}</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
Expand All @@ -64,4 +68,38 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>docker</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<finalName>openapi-diff</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" />
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit e689558

Please sign in to comment.