-
Notifications
You must be signed in to change notification settings - Fork 13
Dev Container の追加 #55
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
動作確認ができました。LGTMです。
細かい点で気になる部分がありますが、合意の取れた改善案については、このPRの変更を叩き台として後から修正する形で良いと思います。
# Rust v1.77 as a base image | ||
FROM rust:1.77-slim | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
curl \ | ||
# install python3, jinja2 pyyaml | ||
python3 \ | ||
python3-pip \ | ||
&& pip3 install --break-system-packages jinja2 pyyaml \ | ||
# install nodejs and serve | ||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& npm install -g serve \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
|
||
WORKDIR /workspace | ||
ENV PATH="/root/.cargo/bin:${PATH}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
大変勉強になります。
懸念点は理解できます。一方でバージョン固定対応をすることで、記述が複雑になったり、管理すべき別ファイルが増えたり、docker build の時間が増えたり、などのデメリットも大きく感じます。
取り急ぎ以下のような編集を行いました。
Python に関しては .github/workflows/deploy.yml での記述に合わせました。こちらでもバージョン固定はされておりませんでしたので、バージョンアップによる不具合が発生した場合にはこちらでも検知でき、.devcontainer/Dockerfile の記述を deploy.yml と合わせておくという認識が取れていれば(覚えていれば)スムーズに対応できるかと思います。
Node.js については、私自身が不慣れでよくわかっていない部分もありますが
こちらでメジャーバージョンは18を指定できていると思います。
serve パッケージのバージョンについては現在の最新版である v14.2.3 に指定いたしました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python, Node.jsの環境については、それぞれpyproject.toml
, package.json
のように標準的な環境管理のためのファイル形式が存在していて、言語ランタイムそのものの管理については、pyenvの.python-version
やnodenvの.node-version
がmiseを含む後発の環境管理ツールで広くサポートされています。CI/CDはアプリケーション本体の開発のために補助的に存在しているものなので、言語ランタイムと依存関係はこういった標準的なファイル形式で集約して管理すべきだと考えています。
しかし、現状では依存しているライブラリが少なく、これらで破壊的な変更が行われる可能性も非常に低いので、確かに管理すべきファイルが増えることのデメリットを上回るメリットがないように感じます。そこで、これらの環境については、サイト構築用のスクリプトの大規模な改変や、Node.js製のLinterの導入をする際に、個別に環境を整備すると良いかと思いました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コメントありがとうございます。方針は同意です。
Node.js のバージョンの方はよくわかっていなかったのですが、deploy.yml をみると JamesIves/github-pages-deploy-action@v4 が使用されているらしく。
確認したところ、こちらの最新版では node20 になっているようでした。
https://github.com/JamesIves/github-pages-deploy-action/blob/dev/action.yml
これも時々刻々と変わってしまうものだと思いますので、とりあえずこのDokcerfile では 18 固定のままでもよろしいでしょうか?
大した手間ではなかったので 20 にしておきました。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub Actionsの各Action内で使用されるNode.jsのバージョンは独立しており、各Actionは内部で指定されているNode.jsのバージョンを使用して実行されます。Marketplaceで公開されているActionの利用者は、内部で指定されているNode.jsのバージョンを気にする必要はありません。
注意が必要なのは、ワークフロー内にてNode.jsに依存するコマンドをrun:
で実行したい場合です。Node.jsに依存した処理を実行するには、前のステップでNode.jsのセットアップを完了させておく必要があり、ここでバージョンを明示的に指定してセットアップを行うと良いです。
このPRにおいてDockerfileで指定するNode.jsのバージョンについては、このままでも大きな問題はないと思いますが、どちらかと言えば既にMaintenanceになっている18.xよりも現在のActive LTSである20.xで固定する方が良いかもしれません1。
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
参考ページを提示していただきありがとうございます!
完全に理解しました()
typst-jp/typst-jp.github.io@9fde1d9
こちらで 20.x にして、Dockerコンテナ内で node -v
して確認できました。
既存のファイルに対する影響はほとんどないので、このPRはマージし、改良点があれば別のPRで行うこととします。 |
#28 に取り組んでみました。
主に以下の点をご確認いただければと思います。
その他、コメントなどありましたらよろしくお願いいたします。