Skip to contentSkip to conversation

Getting a recipe's files from within an image recipe

DISCUSSION [email protected] 2 participants 4 messages Feb 2, 2018

lore
Share & tools
lore
#0 lore raw

I have an app which has a config file, and I'd like my two images (production and dev) to have different configs. Obviously it'd be neater to keep the two config files within the recipe's directory structure. I guess I can't do this in the app's recipe since it has no concept of what image it might end up in. So I could have the the app's recipe deploy one of the configs by default, and use a step in the 'other' image recipe to overwrite it.
But is there a way to tell the image recipe where the app's workdir/srcdir is? Something like ${WORKDIR}_MyRecipe
Or am I just going to have to hard-code the path in?

#1 lore raw
Quoted 10 lines · On 02/02/2018 02:16 PM, [email protected] wrote:

I have an app which has a config file, and I'd like my two images (production and dev) to have different configs. Obviously it'd be neater to keep the two config files within the recipe's directory structure. I guess I can't do this in the app's recipe since it has no concept of what image it might end up in. So I could have the the app's recipe deploy one of the configs by default, and use a step in the 'other' image recipe to overwrite it.
But is there a way to tell the image recipe where the app's workdir/srcdir is? Something like ${WORKDIR}_MyRecipe
Or am I just going to have to hard-code the path in?

Maybe the easiest is to have two separate recipes for the two versions of config and have images pull in one or the other?

Alex

#2 lore raw
Quoted 16 lines · On 02 February 2018 at 12:24 Alexander Kanavin wrote:
Quoted 10 lines · On 02/02/2018 02:16 PM, [email protected] wrote:

I have an app which has a config file, and I'd like my two images (production and dev) to have different configs. Obviously it'd be neater to keep the two config files within the recipe's directory structure. I guess I can't do this in the app's recipe since it has no concept of what image it might end up in. So I could have the the app's recipe deploy one of the configs by default, and use a step in the 'other' image recipe to overwrite it.
But is there a way to tell the image recipe where the app's workdir/srcdir is? Something like ${WORKDIR}_MyRecipe
Or am I just going to have to hard-code the path in?

Quoted 4 lines

Maybe the easiest is to have two separate recipes for the two versions of config and have images pull in one or the other?

Alex

Thanks Alex. I half-had that thought too, but was hoping to do it with the one 'src checkout' of the whole app rather than extra two. Not that that really matters, and it seems it may be the neatest and most robust solution.

#3 lore raw
Quoted 2 lines · Colin Helliwell

Thanks Alex. I half-had that thought too, but was hoping to do it with the one 'src checkout' of the whole app rather than extra two. Not that that really matters, and it seems it may be the neatest and most robust solution.

I believe source checkout is indeed performed only once, even if you have ten different recipes referring to the same SRC_URI. Just throw away the configure-compile-install steps, and focus only on installing the correct configs.

Alex