GitLab Pagesしたい(.gitlab-ci.yml
)
# ベースイメージ
default:
image: node:21
variables:
BASE_URL: $CI_PAGES_URL
MISE_TARBALL: mise-v2024.4.4-linux-x64.tar.gz
MISE_WGET_URL: https://github.com/jdx/mise/releases/download/v2024.4.4/$MISE_TARBALL
# キャッシュするディレクトリ
cache:
paths:
- .venv/
- work/
# miseをダウンロードする場所を work とした
# work がキャッシュされていても失敗しないように、mkdir -p している
# TODO: 毎回ダウンロードしているが、ファイルに変更がない場合はスキップしたい
before_script:
- pwd
- mkdir -p work; cd work
- if ! [ -e $MISE_TARBALL ]; then wget $MISE_WGET_URL && tar zxvf $MISE_TARBALL; fi
- ./mise/bin/mise ls
- ./mise/bin/mise bin-paths
#- ./mise/bin/mise use node@21
#- ./mise/bin/mise use python@3.12
- ./mise/bin/mise use rye
- ./mise/bin/mise bin-paths
- pwd
- cd ..
- pwd
- /root/.local/share/mise/installs/rye/latest/bin/rye config --set behavior.use-uv=true
- /root/.local/share/mise/installs/rye/latest/bin/rye sync
pages:
script:
- pwd
- cd mystmd
- pwd
- /root/.local/share/mise/installs/rye/latest/bin/rye run myst build --html
- mv _build/html/ ../public/
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
deploy:
stage: deploy
script: echo "Define your deployment script!"
environment: production
MySTでドキュメントをビルドするために、PythonとNodeが必要です。
いろいろ試した結果、ベースイメージはnode:21
にすることにしました。
あとは、必要なツールを逆算して、
することにしました。
いろいろ試したこと
mise use python@3.12
すると、インストールに時間がかかるのでやめましたimage: rust
にしてcargo install mise
も5分以上かかったのでやめましたimage: python:3.12
で残りを整えても、myst build --html
でNodeがなくて怒られました。/root/.local/...
にNodeはインストールしてあるのですが、パスの通し方がわからないのでやめました。image: node:21-slim
にしたら、イメージ準備にかかる時間は減りましたが、後ろの方でエラーがでたのでやめました
ということで。
結果、node:21
をベースにして、そこにPython環境を構築することにしました。