app icon indicating copy to clipboard operation
app copied to clipboard

[Enhancement Request] - Use version metadata in docker-app configuration as an environment variable

Open jhrabi opened this issue 7 years ago • 5 comments

I have a case where I want to keep a version of an image used in the docker app configuration to have the same tag as the version of the docker-app configuration. It would be useful if we could reference the version of the docker-app configuration as an environment variable in the settings part of the file.

Example:

# This section contains your application metadata.
# Version of the application
version: 1.1.0
...
---
# This section contains the Compose file that describes your application services.
...
---
# This section contains the default values for your application settings.
CONTAINER_TAG: ${DOCKERAPP_VERSION}

jhrabi avatar Sep 27 '18 17:09 jhrabi

Hi. Though not exactly what you ask, the metadata are exposed as variables using the app. prefix. So in your compose file you can do

services:
  myserver:
    image: myserver:${app.version}

mnottale avatar Sep 28 '18 08:09 mnottale

It's really close to what I'm looking for, but it looks like the settings doesn't intepret the app.version value. Using the following example:

version: nanoserver
name: helloworld
---
version: "3.6"
services:
  helloworld:
    image: helloworld:${CONTAINER_TAG}

---
CONTAINER_TAG: ${app.version}

I get the following from docker-app render:

version: "3.6"
services:
  helloworld:
    image: helloworld:${app.version}

As oppose to what I would expect which is

version: "3.6"
services:
  helloworld:
    image: helloworld:nanoserver

I'm looking for this specific behaviour so I can override the app.version value assigned to the tag if required.

jhrabi avatar Sep 28 '18 15:09 jhrabi

Your example will work if you use an experimental build, since the yatee renderer recurses variable evaluation.

mnottale avatar Sep 28 '18 15:09 mnottale

Would there ever be plans for making this a main feature, instead of experimental?

jhrabi avatar Sep 28 '18 18:09 jhrabi

@jhrabi yes, we will have some form of templating as a main feature. The reason this is all behind experimental is that we want to find the right UX, engine, etc.

chris-crone avatar Oct 01 '18 08:10 chris-crone