Skip to content

[Feature] Long syntax for images names #13704

@sprat

Description

@sprat

Description

I am currently building & running images in CI using this pattern:

  1. compose file:
services:
  my:
    image: myimage:${VERSION}
    build:
      args:
        VERSION: ${VERSION}
      tags:
        - myimage:${VERSION}
        - myimage:latest
  1. .env file:
VERSION=1.0.0

Then I use a (renovate) bot to bump the version number automatically in my CI whenever the upstream package is updated.

Ideally, I would prefer putting the version number in the compose file using an extension & anchor, and then use the version number later in the compose file using aliases. But I can't because I have to "compute" the full image name from the version anchor, and I can't find a way to do that.

In fact, I would like to do something like this:

x-version: &version 1.0.0

services:
  my:
    image:
      name: myimage
      tag: *version
    build:
      args:
        VERSION: *version
      tags:
        - name: myimage
          tag: *version
        - name: myimage
          tag: latest

Note 1: not sure about if the attribute name is named appropriately, maybe use repository or something else?
Note 2: in fact the same problem occur for all the other "composite" fields that don't have long syntax

The end purpose is to have a self-contained compose file that can be easily updated by my "dependency update" bot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions