Bun and react deployment

Hi, sorry I’m at the limit of my own research and I’m very tired. I followed some bun/react boilerplate but moved the front and back end into src/front and src/back folders for my own organization. Using fly launch/deploy for the project yields a blank page served, I’m assuming from not actually building the front end in the dockerfile, which fly launch gives as:

FROM pierrezemb/gostatic
COPY . /srv/http/
CMD ["-port","8080","-https-promote", "-enable-logging"]

Surely this isn’t supposed to be a one-size-fits-all treatment for a dockerfile? I remember a couple of years ago doing a bun/react stack and I had a long dockerfile. If this is what fly sends out by default I feel a little duped because trying to search for fixes results in articles that say “the default should work,” though I’m prepared for you guys to tell me why I’m a fuckin moron.

Hi… Sorry to hear you’ve been having so much trouble with this, :adhesive_bandage:. No, fly launch will create very elaborate Dockerfiles sometimes; it probably just guessed wrong in this case.

Glancing at the flyctl source code, the one that you got there seems to be what it produces when it guesses that you want an (old-school) static Web site (i.e., a pile of HTML files).

If you already know how to make a Dockerfile yourself, then that would be the best option. That is the oldest and most reliable way of using Fly.io.

(If not, then I would try undoing the src/front and src/back directory splitchanges and then seeing whether fly launch or npx dockerfile(?) detected things better. If that works, then you can post the results here, and those of us who know Dockerfiles but not the Javascript ecosystem in detail might be able to give some tips on converting it to your preferred directory layout, etc.)

I guess what I need is what fly’s opinions are on directory structure because I goofed this up at the root and I really don’t want to change it. I don’t think it’s a wild thing to put your frontend and backend in different folders.

Yep. Moreover, it is best to get an app working locally, which requires a Dockerfile. It should then work remotely with minimal/no Dockerfile modifications (though it is not surprising to need the odd environment variable tweak here and there).

If you don’t have a local stack, I personally would fix that next.

You should probably have some logs in Fly or your container to tell you what is going wrong.

I did indeed not have a working local build and bad dockerfile which I fixed today after sleeping a lot. Thanks for the help.