Tailwind not working in production (no styles just plain html)

You need to move this line above the assets.deploy one:

COPY lib lib

We do this on master now when generating the Dockerfile for phx.gen.release --docker, but the tldr; is tailwind needs to have access to the lib/app_web directory to build the styles from your file patterns in the tailwind config. Since lib is copied after running assets.deploy in your docker file, it won’t see any of your files and thus won’t produce any included classes. Move that to after the deploy command and you are golden!

12 Likes