Inside Dockerfile, how to access url/branch most recently used in dokku git:sync app giturl branch
?
#6869
-
I am deploying open source Spring Boot applications to dokku via this workflow:
Which is working fine, except for one thing. I want to use this plugin to get information about the most recent commit and expose it inside the application. This is very helpful for knowing which version of the app is running right from the app itself. It works in the dev environment (i.e. outside of dokku) where the normal case is that the default directory where the final command to run the spring boot process is also a github repo directory. But I've been unable to access any git information inside the docker container. It does not appear to be the case that there is any directory that is a git directory, nor is there any environment variable that carries this information, and there doesn't seem to be any clear way to pass the information into the docker process automatically. Since the spring-boot process isn't a git directory, you just get this: Am I missing something? Or is what I'm trying to do simply not feasible? Tl;dr: I want to be able, in the Dockerfile, to access the URL of the latest git sync and the name or SHA of the branch that was passed on the git:sync line so that I can make the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hmm... this seems related: #5901 and give me some things to try, though it's not entirely clear whether it's a solution. |
Beta Was this translation helpful? Give feedback.
-
I believe this was answered on Slack, but you can use the |
Beta Was this translation helpful? Give feedback.
I believe this was answered on Slack, but you can use the
keep-git-dir
git property: https://dokku.com/docs/deployment/methods/git/#keeping-the-git-directory