Deploying a Rails 7 app works fine when invoking fly deploy locally. However when using a CD (GH actions), it fails with this message:
#17 [build 6/10] COPY --link .yarn/releases/* .yarn/releases/
[74](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:75)#17 ERROR: lstat /data/docker/tmp/buildkit-mount161928135/.yarn/releases: no such file or directory
[75](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:76)------
[76](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:77) > [build 6/10] COPY --link .yarn/releases/* .yarn/releases/:
[77](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:78)------
[78](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:79)Error: failed to fetch an image or build from source: error building: failed to solve: lstat /data/docker/tmp/buildkit-mount161928135/.yarn/releases: no such file or directory
[79](https://github.com/<my-repo>/actions/runs/7389432303/job/20102561322#step:4:80)Error: Process completed with exit code 1.
I can explain what the message is trying to tell you, and perhaps we can work from there.
When you run fly deploy locally, the files you have – locally – will be used to satisfy the COPY --link .yarn/releases/* statement. Since you said that succeeded, those files are present locally.
When you run CD, github will checkout <my-repo> (I’m assuming this is your way of redacting the repository name), and then run fly deploy against that copy. Since that fails, that would indicate that the .yarn/releases directory is not committed and pushed.
Possible solutions include:
Committing and pushing .yarn/releases. Check your .gitignore ?
Adding extra run steps to your workflow to install yarn. You might be able to find a GitHub action to help here.
Change your Dockerfile to not attempt to COPY these files but instead install the relevant version of yarn
An example of what the final option would look like:
If you look at .yarnrc you will see yarn-path in there. You can delete that one line, or even the entire file, or remove .yarnrc from the COPY line above the one with .yarn/releases.
Or you can keep all that, and make sure that .yarn/releases is committed and pushed to your git repository.