tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

not working in docker

Open tsukinoko-kun opened this issue 1 year ago • 2 comments

What version of Tailwind CSS are you using?

3.4.3

What build tool (or framework if it abstracts the build tool) are you using?

Docker Compose

What version of Node.js are you using?

For example: 20.13.1

What browser are you using?

N/A

What operating system are you using?

macOS

Describe your issue

When running tailwindcss cli in a docker container, it isn't doing anything. Exits with code 0.

FROM node:current-bullseye
WORKDIR /App/BlazorApp
RUN ["npm", "install", "-g", "pnpm"]
ENTRYPOINT ["bash", "-c", "pnpm install && pnpm exec tailwindcss -i ./Styles/app.css -o ./wwwroot/app.css --watch"]

Isn't working with or without --watch. Isn't working with or without tty: true in compose.yaml (#5324).

If I run the same thing outside of Docker it works as expected.

tsukinoko-kun avatar May 19 '24 21:05 tsukinoko-kun

I ensured that the tailwind config, package.json, input files (css, html, razor) are available and the container has write access.

tsukinoko-kun avatar May 19 '24 21:05 tsukinoko-kun

@tsukinoko-kun maybe stdin_open: true along with tty: true will help for your case?

maxdzin avatar May 22 '24 15:05 maxdzin

You'll want to specify both stdin_open: true and tty: true in a docker compose file or you can run with the flags -t and -i. Our CLI exits when stdin is closed — this is a standard behavior for CLI tools. Alternatively, you can specify --watch=always which will not exit when stdin closes.

Here's an example compose file that works:

services:
  web:
    build: .
    tty: true
    stdin_open: true
    volumes:
      - type: bind
        source: ./app
        target: /App/BlazorApp

Or an example docker run command (assumes code is located at ./app in the current dir):

docker run -dti -v $(pwd)/app:/App/BlazorApp $(docker build -q .)

thecrypticace avatar May 31 '24 23:05 thecrypticace