Fix the bug that app built by default Dockerfile cannot fetch Envs#107
Merged
haoozhang merged 1 commit intoJan 20, 2025
Merged
Conversation
haoozhang
commented
Jan 17, 2025
| // todo: hardcode jdk-21 as base image here, may need more accurate java version detection. | ||
| //const DefaultDockerfileForJavaProject = `FROM openjdk:21-jdk-slim | ||
| //COPY ./target/*.jar /app.jar | ||
| //ENTRYPOINT ["sh", "-c", "java -jar /app.jar"]` |
Author
There was a problem hiding this comment.
Here use sh -c before, which make the command run in the shell context, and the Envs cannot work as expected.
Now run the command directly and let Docker handle the command execution directly, ensuring the environment variables propagate correctly.
saragluna
approved these changes
Jan 20, 2025
Author
|
The test failures should not be because of this code change, will merge this first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix the bug that app built by default Dockerfile cannot fetch Envs.
The root cause is that, use
sh -cbefore, which make the command run in the shell context, and the Envs cannot work as expected. Now run the command directly and let Docker handle the command execution directly, ensuring the environment variables propagate correctly.Test by running the https://github.com/azure-javaee/azure-spring-boot-samples/tree/main/postgresql/spring-cloud-azure-starter-jdbc-postgresql/spring-cloud-azure-postgresql-sample