fly launch error: open Dockerfile: no such file or directory

Hi,

I just tried to follow the Next.js tutorial for an existing next.js project on my local computer.

It failed at detecting the Next.js app but detected NodeJS app. It asked for the app name, the region to deploy, and if I want PG and Redis. After that it failed with the following error:
Error: open Dockerfile: no such file or directory

Am I doing something wrong? I don’t have Docker in that directory.

Thanks,

Cagdas

I’m actively working on making that better. If broke something, I’ll fix it. I just tried npx create-next-app@latest and launched it successfully.

First, does flyctl version return 0.1.23? If not, try flyctl version update

Next, is there now a line in your package.json that reads:

    "@flydotio/dockerfile": "^0.2.11"

If it is there, but the wrong version, try:

npm install @flydotio/dockerfile@latest --save-dev

If you get this far, try:

npx dockerfile

Hi,

Thank you for the quick response.
I have the following fly version:
flyctl v0.1.23 darwin/arm64 Commit: 4aa1bbf64fc3d6696450dec51ccd0bfd5782454c-dirty BuildDate: 2023-05-30T15:29:05Z

After fly launch I get the following:

...
installing: pnpm add -D @flydotio/dockerfile

Packages: +35

+++++++++++++++++++++++++++++++++++

Progress: resolved 415, reused 396, downloaded 11, added 15, done

devDependencies:

+ @flydotio/dockerfile 0.2.11

Done in 2.8s

Error: open Dockerfile: no such file or directory

npx dockerfile doesn’t seem to do anything.

I hadn’t tested that release with pnpm. I’ve pushed out a new release. The following should get you back on track:

pnpm add -D @flydotio/dockerfile@latest
npx dockerfile

Edit: The above presumes that you have a fly.toml file. If you don’t, run fly apps list to see if your app is there. If so, you can destroy it using fly destroy -y followed by the app name, then run fly launch again.

Oh wow! Thanks, it worked.

Quick question: why does the fly launch not recognize the next.js app and falls back to nodejs?

Finally, is fly launch just a helper? That is, once I am more familiar with the Fly platform, can I just create my fly.toml and Dockerfile’s by hand and not worry about automated scripts?

Thanks,

Cagdas

I’ll give quick answers, but feel free to ask follow up questions if you want more depth.

Node has too many frameworks. And options. For example, you are using pnpm. Supporting each combination is unworkable. So, I’m starting over. I built a base that supports all node apps, and then adding specific tailoring based on feature detection. That way pnpm support is implemented exactly once and works with all frameworks.

More: Fly.io :heart: JS and dockerfile-node.

Indeed. If you want to chase all the way down the rabbit hole, you will end up with a REST interface. There also are more granular CLI commands that will do specific tasks, like create an application, clone a machine, set a secret, or create a volume. The fly.toml file itself is only needed by the helpers, and Dockerfiles are but one way to create an OCI image.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.