-
Notifications
You must be signed in to change notification settings - Fork 65
fix: migrate openapi Dockerfile from Docker to UBI #947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,19 +1,18 @@ | ||||||
| FROM docker.io/openapitools/openapi-generator-cli:v7.16.0 | ||||||
| FROM registry.access.redhat.com/ubi9/ubi:9.7 | ||||||
|
|
||||||
| RUN apt-get update | ||||||
| RUN apt-get install -y make sudo git golang-1.21 | ||||||
| # Install Java (to run openapi-generator), Go (for gofmt), and git | ||||||
| RUN dnf install -y java-17-openjdk-headless go-toolset git && dnf clean all | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| # Download openapi-generator-cli JAR | ||||||
| RUN curl -L -o /usr/local/bin/openapi-generator-cli.jar \ | ||||||
| https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar | ||||||
|
Comment on lines
+7
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check if the file exists and read its full content
fd -t f "Dockerfile.openapi" --exec cat -n {}Repository: ambient-code/platform Length of output: 963 🏁 Script executed: # Also search for any checksum or SHA references in the same directory
rg -A 5 -B 5 "openapi-generator" components/ambient-api-server/ 2>/dev/null || echo "No matches found"Repository: ambient-code/platform Length of output: 22302 🏁 Script executed: # Check git history to see if there were related changes
git log --oneline --all -- "components/ambient-api-server/Dockerfile.openapi" 2>/dev/null | head -20Repository: ambient-code/platform Length of output: 249 Harden the JAR download with fail-fast and integrity verification On lines 7–8, Proposed fix+ARG OPENAPI_GENERATOR_VERSION=7.16.0
+ARG OPENAPI_GENERATOR_SHA512=<pin-from-maven-central>
# Download openapi-generator-cli JAR
-RUN curl -L -o /usr/local/bin/openapi-generator-cli.jar \
- https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.16.0/openapi-generator-cli-7.16.0.jar
+RUN curl -fsSL -o /tmp/openapi-generator-cli.jar \
+ "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${OPENAPI_GENERATOR_VERSION}/openapi-generator-cli-${OPENAPI_GENERATOR_VERSION}.jar" \
+ && echo "${OPENAPI_GENERATOR_SHA512} /tmp/openapi-generator-cli.jar" | sha512sum -c - \
+ && mv /tmp/openapi-generator-cli.jar /usr/local/bin/openapi-generator-cli.jar🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed |
||||||
|
|
||||||
| RUN mkdir -p /local | ||||||
| COPY . /local | ||||||
|
|
||||||
| ENV PATH="/ambient/bin:/usr/lib/go-1.21/bin/:${PATH}" | ||||||
| ENV GOPATH="/ambient" | ||||||
| ENV GOBIN /usr/lib/go-1.21/bin/ | ||||||
| ENV CGO_ENABLED=0 | ||||||
|
|
||||||
| WORKDIR /local | ||||||
|
|
||||||
| RUN bash /usr/local/bin/docker-entrypoint.sh generate -i /local/openapi/openapi.yaml -g go -o /local/pkg/api/openapi | ||||||
| RUN java -jar /usr/local/bin/openapi-generator-cli.jar generate -i /local/openapi/openapi.yaml -g go -o /local/pkg/api/openapi | ||||||
| RUN rm /local/pkg/api/openapi/go.mod /local/pkg/api/openapi/go.sum | ||||||
| RUN rm -rf /local/pkg/api/openapi/test | ||||||
| RUN rm -rf /local/pkg/api/openapi/git_push.sh | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.