app
app copied to clipboard
[Enhancement Request] - Use version metadata in docker-app configuration as an environment variable
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}
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}
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.
Your example will work if you use an experimental build, since the yatee renderer recurses variable evaluation.
Would there ever be plans for making this a main feature, instead of experimental?
@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.