Help! Can't deploy React+Phoenix right on Fly

So I’m following this guide: Modern Webapps with React, Phoenix, Elixir and TypeScript

It seems to work all right (fly deploy), but accessing the production app has an error! I think it’s related to the mix webapp task that tries to compile the React application and put it in the static folder.

My naive guess on how to do it is just to add “RUN mix webapp” in the Dockerfile. Is that correct??

Any help would be appreciated!

See the full code GitHub - mwufi/phx-react-test

The error:
could not read file...

UPDATE:

Two things:

  1. mix webapp fails silently if there are any errors (which prevents it from making the dist folder & the index.html…). In the future, we can see how to make it display error messages!!!

  2. Here is the real kicker – In the Docker env, we don’t have frontend folder :joy:. The solution is just
    image

How to make it work

First, copy the frontend folder to the Docker environment!

Next, be sure to run “mix webapp”. In mix.exs, add it to the “assets.deploy” pipeline:

      "assets.deploy": ["tailwind default --minify", "esbuild default --minify", "phx.digest", "webapp"]

Then we’re good!