dnephin / dobi

A build automation tool for Docker applications
https://dnephin.github.io/dobi/
Apache License 2.0
309 stars 36 forks source link

Only one tag is applied on image:build #148

Closed Fuco1 closed 6 years ago

Fuco1 commented 6 years ago

When I have two tags in an image task

image=deps-prod:
  image: image
  pull: always
  tags:
    - "{env.LOCKFILE_HASH}-prod"
    - prod-build
  dockerfile: Dockerfile.deps.prod
  depends:
    - "compute-lockfile-hash:capture(LOCKFILE_HASH)"
    - base-dev
  args:
    NPM_TOKEN: "{env.NPM_TOKEN}"

only the first one is applied during the build. I need both tags to be applied because currently COPY --from=... does not support build args and so I have to have a static name also.

dnephin commented 6 years ago

Yup, this behaviour is documented for :build. There are cases where someone may want to build to a unique tag, run tests then later tag other mutable tags.

To tag all the tags use the :tag action deps-prod:tag. You can use this anywhere you would use just deps-prod (ex: from the command line, or as a depeds:). The tag action automatically adds the :build action as a dependency.

Fuco1 commented 6 years ago

So this is supposed to prevent someone "over-tagging" a working image with a broken new build, correct? I think it makes sense, thanks. It's a bit unexpected behaviour, but I'm not sure if there's something to do about that (i.e. use a different config field or something like that).