Hey, new to Fly.io. I am trying to deploy my Node.js app which uses pnpm monorepo so I figured I’ll use the same Dockerfile setup I’ve before with Jenkins.
However, as I try to deploy with the Dockerfile defined in the GitHub action I receive:
Error failed to fetch an image or build from source: Dockerfile '/home/runner/work/realtime-multiplayer-in-html5/realtime-multiplayer-in-html5/packages/server/Dockerfile' not found
When I try to use my local fly client with fly.toml where dockerfile = "packages/server/Dockerfile" it throws a similar error:
Error failed to fetch an image or build from source: error building: failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /data/docker/tmp/buildkit-mount477066803/packages/server/Dockerfile: no such file or directory
I have no idea why it can’t find the Dockerfile. Possibly the context is not being passed properly but don’t know how to configure/fix that.
First, yep, Fly will default to looking for a Dockerfile in the root folder of the application. And complain if it’s not there.
Looking at the repo, indeed it’s not there. So you could make a copy there, in the root. Or debug why dockerfile = "packages/server/Dockerfile" doesn’t work. Since that would indeed normally be the solution to this (like if you have a Dockerfile called something else, like Dockerfile.txt you would do dockerfile = "Dockerfile.txt").
However I’m wondering if the problem you’re running into there is the presence of this line:
Since Dockerfile is treated differently when ignored. Take a look at:
So I’d try removing it from .dockerignore and/or copy to the root folder depending on that. Those are going to be easiest to debug/edit. Then it should be able to find it.
Amazing that fixed it, thanks a lot! Yes, indeed I am ignoring the Dockerfile. Dont remember exactly why I did that in the first place, maybe some issue with docker compose that happened.