How can I build a docker image and tag it with the...
# 🤖|ask-kapa
s
@microscopic-river-74022 How can I build a docker image and tag it with the git branch or latest?
m
Please stand by @salmon-scientist-57815 as I search the knowledge base. I normally take about 15 seconds or so. :wave:
---------------------- To build a Docker image and tag it with the git branch or "latest" using Garden, you can use the
garden publish
command with the
--tag
option. Here's how you can do it: 1. For tagging with the git branch:
Copy code
garden publish --tag 'v0.1-${git.branch}'
2. For tagging with "latest":
Copy code
garden publish --tag "latest"
These commands will build the Docker image and apply the specified tag. The
${git.branch}
is a template string that Garden will replace with the current git branch name. It's important to note that you should wrap templated tags with single quotes to prevent your shell from attempting to perform its own substitution. You can also use other template strings available for action configs. For example: -
${build.version}
for the full Garden version of the build -
${build.hash}
for the Garden version hash of the build Publishing images () provides more details on how to use these template strings and other options for publishing images with Garden. Remember that before publishing, you need to specify the
publishId
field in your container action's
spec
to indicate where the image should be published, unless you're publishing to your configured deployment registry when using the
kubernetes
provider. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
message has been deleted
2 Views