Running docker build, don't see generated files by the action

Lets say i have github action with the following steps

      - name: create file
        run: echo content > file.txt
        shell: bash

      - name: Build the docker image 
        run: |
            docker build . --file Dockerfile
        shell: bash

The content of docker file is:

COPY ./file.txt ./

I get an error:
COPY failed: stat /var/lib/docker/tmp/docker-builder611432326/file. txt: no such file or directory

After some debugging, i believe that the docker build see only files that came with the repository, and not generated in the action.
Is it a known limitation?
Is there a workaround for that?
Thanks!

Hi @bnaya,

I copied your code and cannot repro the same on my side, my workflow here.
Could you please share the repo/sample repo for further investigation?

Thanks.

1 Like