Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind CSSのソフトウェア再現性が保証されていない #42

Closed
exflikt opened this issue Sep 21, 2024 · 3 comments
Closed
Labels
task Work, todo, refactor by maintainers; see also 'ask' label

Comments

@exflikt
Copy link
Collaborator

exflikt commented Sep 21, 2024

開発環境コンテナ Dockerfile

&& curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
にある tailwindcss バイナリのダウンロードリンクが latest になっていて、バージョン違いで出力CSSファイルの内容が異なる現象が発生するかもしれないです。そこで、バージョンアップグレードを容易にすることも加味して、Tailwind CSS の使用バージョンを見える形で保存し、 Dockerfile でその値を読み取るようにしたいです。.tailwindcss-version という名前のファイルを用意するのが良いと思います。

#37 の一環で、 main にマージする前に出力CSSファイルの整合性を確かめるつもりです。なので、本番環境 Dockerfile

murchace/Dockerfile

Lines 5 to 13 in 6e1ffb1

&& curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
&& chmod +x tailwindcss-linux-x64 \
&& ln -sf tailwindcss-linux-x64 tailwindcss \
&& microdnf clean all
COPY --from=ghcr.io/astral-sh/uv:0.4.0 /uv /bin/uv
COPY . /murchace/
WORKDIR /murchace
RUN uv sync --frozen \
&& tailwindcss --minify -i app/styles.css -o static/styles.min.css
tailwindcss バイナリのインストールと static/styles.min.css の生成をする必要はないです。

@exflikt exflikt added the task Work, todo, refactor by maintainers; see also 'ask' label label Sep 21, 2024
@dodolia907
Copy link
Member

テストでビルドするときに容易にバージョンを変更できるようにARGを使うというのも浮かんだんですが, .tailwindcss-version という名前のファイルを用意するのとどちらのほうが良さそうですかね?
https://docs.docker.jp/engine/reference/builder.html#arg

@exflikt
Copy link
Collaborator Author

exflikt commented Sep 22, 2024

#43 でバイナリをインストールしてくれる https://github.com/timonweb/pytailwindcss を追加しました。これで、バージョンを環境変数 $TAILWINDCSS_VERSION で指定できるようになります。#43 では justfile に直書きしてますが、just TAILWINDCSS_VERSION=latest tailwind-watch で最新版のtailwindcssバイナリを自動でインストールして実行もしてくれます。

バージョン取得は↓のコマンドでいけます:

$ just -c env | grep TAILWINDCSS_VERSION | cut -d= -f2
v3.4.11

このやり方がいいのかは自分でもまだ分からないですけど...

@exflikt
Copy link
Collaborator Author

exflikt commented Sep 27, 2024

#60 のワークフローで、生成されたCSSファイルをCIテストできるようになったので閉じます。

@exflikt exflikt closed this as completed Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task Work, todo, refactor by maintainers; see also 'ask' label
Projects
None yet
Development

No branches or pull requests

2 participants