Update cli docker base to eclipse-temurin:17-jre-alpine #12265
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.N/A - not targeting a specific generator here and it doesn't appear any of these scripts use the docker image.
3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.N/A - not targeting particular programming language
Description of the PR
This addresses the
UnsupportedClassVersionError
exceptions reported in issues #12240 and #12242 for the 3.0.0 branch.The error can be reproduced simply by running the docker image with
generate --help
:The
UnsupportedClassVersionError
is because theswaggerapi/swagger-generator-v3:3.0.50
docker image installs Java 8 (class version 52) as can be seen in the docker image history [1] and the Dockerfile itself [2]. The Logback library version 1.4.11 [3] used by swagger codegen is being built targeting Java 11 [4] (class file version 55).The logback library could potentially be rolled back to a version built targeting Java 8 (1.3.x [4]). However, the codegen CLI is the only Dockerfile here on the 3.0.0 branch that is using a Java 8 runtime. The others are using Java 17 though from different base images:
The top-level Dockerfile is based on
openjdk:17-jdk-alpine
:swagger-codegen/Dockerfile
Line 1 in fc4e952
The swagger-generator module Dockerfile uses Java 17 via
eclipse-temurin:17-jre
:swagger-codegen/modules/swagger-generator/Dockerfile
Line 9 in fc4e952
The swagger-codegen-cli module Dockerfile uses Java 8 via
openjdk-8-jre-alpine
:swagger-codegen/modules/swagger-codegen-cli/Dockerfile
Line 1 in fc4e952
Given that, it seems reasonable to update swagger-codegen-cli to also use Java 17 which is the change I have made here.
I validated the change by manually building the image and testing
generate --help
and running a go client generation:References:
[1] https://hub.docker.com/layers/swaggerapi/swagger-codegen-cli-v3/3.0.50/images/sha256-10f28ee6ef4dc6ad4871947b38347cd1fa61dea6537a87d0309605cd6f2b9185?context=explore
[2]
swagger-codegen/modules/swagger-codegen-cli/Dockerfile
Line 1 in fc4e952
[3]
swagger-codegen/pom.docker.xml
Line 1136 in fc4e952
[4] https://github.com/qos-ch/logback/blob/master/README.md#java-ee-and-jakarta-ee-versions