Skip to content

Missing class from precompiled output after building with Docker #546

Closed as duplicate of#524
@omegahm

Description

@omegahm

I have a brand new Rails (8.0.2) project with Ruby 3.4.2:

$ rails new ThisAndThat --css tailwind --js importmap --database sqlite3

I add a div with a class of max-h-8 to the layout/application.html.erb file.
If I now run tailwindcss binary, I get:

$ bundle exec tailwindcss --input app/assets/tailwind/application.css -o - | grep "max-h-8"
≈ tailwindcss v4.1.5
  .max-h-8 {
Done in 39ms

This works. So it shows in my local development just fine.

I now want to deploy my project with a Docker image. I run:

$ docker buildx build --progress plain --platform linux/amd64/v2 --tag thisandthat --load .

which builds me a Docker image. I build with that platform argument, because I am on an M2 MacBook and want to run the Docker image on a Ubuntu server.

I launch an interactive shell with:

$ docker run -it --rm thisandthat bash

and look at the compiled Tailwind CSS for the class max-h-8:

$ cat public/assets/tailwind-* | grep "max-h-8"

This comes up empty! 🚫

If I do the same with another class, say z-auto, or even max-h-[8px] it works flawlessly.

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions