#Tailwind error when trying to deploy to fly.io

1 messages · Page 1 of 1 (latest)

elfin nacelle
#

When trying to deploy my fullstack gleam application, it ends up building everything, my website 'works' but there's no css! I'm using tailwind, everything runs fine using gleam run -m lustre/dev start locally.

I suppose something went wrong building/bundling tailwind, because of the following logs, only i'm not sure what because there doesn't seem to be any error message. Is there something special I need to do to make tailwind work on production deployments?
i tried using the following guide: https://hexdocs.pm/lustre/guide/07-full-stack-deployments.html , but with a few adaptations:

  1. i added some extra dependencies after some errors trying to build my frontend

Install build dependencies

RUN apk add --no-cache elixir nodejs npm git

Install Hex package manager for Elixir

RUN mix local.hex --force

  1. i decided to build to another folder (i dont want it to build inside my backend folder)

Compile the client code and output to static directory

RUN cd /build/lustre_football_matchmaking
&& gleam add --dev lustre_dev_tools
&& gleam run -m lustre/dev build app --minify --outdir=/build/static

from which afterwards the files get copied:

Copy the compiled server code from the builder stage

COPY --from=builder /build/api_football_matchmaking/build/erlang-shipment /app

Copy the static files to the app directory

COPY --from=builder /build/static /app/static

Am I doing anything wrong/ not up to standards? any recomendations?

See screenshots to see how i serve my frontend in my backend router file:

willow trout
#

if you're using an alpine image then currently it wont work, i havent shipped the fix yet

#

the tailwind binary change how its build from v3 to v4 and now there are separate musl binaries and we dont currently detect when these are necessary

#

im not too well-versed with docker but if possible i would do the build on an ubuntu container and copy the build frontend to an alpine container for deployment

elfin nacelle
#

thanks so much! i'll try it!

subtle heart
#

you can use a glibc-based image (like basically dropping the -alpine and using that) as the builder and alpine to run it if you care about the image sizes