Docker Hub Automated Build - Tagging

前端 未结 7 1711
逝去的感伤
逝去的感伤 2020-12-24 01:15

When specifying an Automated Build on Docker Hub, I can set some settings (Type (\'Branch\' or \'Tag\'), Name, Dockerfile Location and

7条回答
  •  时光取名叫无心
    2020-12-24 01:53

    Automated docker image tagging is available on dockerhub! I fiddled with this recently and wanted to share my findings, jumping on this thread (hope it's ok!)

    So I have a public GitHub repo with an automated build link on dockerhub. I want the :latest tag to be updated every time I push to the master branch. Also, I want :X, :X.Y and :X.Y.Z tags to be created for every release I create on GitHub (tagged as vX.Y.Z on GitHub).

    Here is how the build settings config looks like to support this:

    And in text so it's easier to copy-paste:

    | Type   | Name                              | Dockerfile Location | Docker Tag Name |
    |--------|-----------------------------------|---------------------|-----------------|
    | Branch | master                            | /                   | latest          |
    | Tag    | /^v([0-9]+)\.([0-9]+)\.([0-9]+)$/ | /                   | {\1}            |
    | Tag    | /^v([0-9]+)\.([0-9]+)\.([0-9]+)$/ | /                   | {\1}.{\2}       |
    | Tag    | /^v([0-9]+)\.([0-9]+)\.([0-9]+)$/ | /                   | {\1}.{\2}.{\3}  |
    

    Hope this helps!

提交回复
热议问题