title: How to pass GitLab CI file variable to Dockerfile and docker container?
body: <p>GitLab CI allows adding custom variables to a project. </p>
  
  <p>It allows to use a secret variable of type <code>file</code> where I specify a Key that is the variable name and Value that is the content of a file(e.g. content of certificate)</p>
  
  <p>Then during execution of the pipeline the content will be saved as a temporary file and calling the variable name will return the path to the created file.</p>
  
  <p>Ultimately I need to copy this file to a Docker container that is created when building the project. (<code>docker build ...</code> in the yml)</p>
  
  <p>When testing if the variable works, I tried <code>echo $VARIABLE</code> in <code>.gitlab-ci.yml</code> and it works, returns path of temp file. But when doing <code>RUN echo $VARIABLE</code> in the <code>Dockerfile</code>, it is empty. Therefore I also cannot use <code>ADD $VARIABLE /tmp/</code> which is my goal.</p>
  
  <p>Is there a way to solve this and make this file available to the <code>Dockerfile</code>? I am new to Docker and GitLab and not sure where else to look.</p>