-1

I have a Dockerfile that in one of its RUN instructions creates a conan file. I'd like to edit and save that conan file in my Dockerfile to set project specific settings. Is there a way to do so via command line, for example the Python prompt?

Alternatively is there a way to embed a Python file in a Dockerfile?

ruipacheco
  • 15,025
  • 19
  • 82
  • 138
  • What do you mean by `do so via command line`? And use `ADD` to add a python file to image is not what you needed? – atline Jun 04 '19 at 02:22

1 Answers1

0

I don't know any command to do so. But I would suggest you to use another approach :

  1. Create a Conan template file with environment variables as placeholders (youconanfile.dist).
  2. use envsubst command in order to runtime-create the file you need with current project variables.

I use this technique in a Docker stack to generate multiple files (wp-cli.yml, deploy.php...). My example is in a Makefile. If you need to use it in your Dockerfile, it is possible assuming that

  • envsubst is installed on your container
  • COPY command is used for pushing the Conan template file in your container.
nbonniot
  • 1,034
  • 16
  • 33