TailwindCSS Standalone CLI not working in Alpine Linux (docker)
See original GitHub issueThe tailwindcss binary release is not working on Alpine Linux.
Tested with the release tailwindcss-linux-x64 v3.0.7 on the latest docker alpine image.
If I run an alpine container (installing curl, and downloading the standalone release as described here https://tailwindcss.com/blog/standalone-cli#get-started ) I got nothing (binary not found). Running the exact same steps in debian works.
Tell me if I need to provide more information.
Example steps to reproduce it:
#On the host
docker run -it --rm alpine ash
#Within the container
apk add curl
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
mv tailwindcss-linux-x64 tailwindcss
./tailwindcss init
# Got => ./tailwindcss: not found
The exact same steps works fine using debian for example:
#On the host
docker run -it --rm debian bash
#Within the container
apt update
apt install curl # Type Y to install
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
mv tailwindcss-linux-x64 tailwindcss
./tailwindcss init
# Generate tailwind.config.js
Edit:
Here is the output of file
:
tailwindcss: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=2e882d60273a4031f72a88815a36cb574dc1090b, for GNU/Linux 2.6.32, stripped
Seems I need to install some libraries…
Edit 2: This answer from SO seems relevant to the issue: https://stackoverflow.com/a/66974607
Executables built on glibc distributions depend on /lib/x86_64-linux-gnu/libc.so.6, for example, which is not available on Alpine (unless, they are statically linked).
So is it possible to statically link dependencies when compiling the binaries?
Edit 3: Some workarounds are based on installing gcompat and/or libc6-compat, but those do not fix the tailwindcss issue.
Edit 4:
I just noticed that the standalone CLI is using a tool called pkg
under the hood.
So maybe this issue does not belong here… If so, feel free to close.
Edit 5: As stated below, installing both gcompat
and build-base
solves the problem.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
I added a suggestion to switch to static builds here: https://github.com/tailwindlabs/tailwindcss/discussions/6785
@DistantMe, Indeed, as also stated by @mveytsman, for me
gcompat
andbuild-base
solves the problem too!I tried many different libraries (but rather in a random way)… I should have tried in a better way those two one together… Anyway, thank you very much for your inputs… Closing the issue…