在 GitLab Pages 上部署#

与 GitHub Pages 类似,JupyterLite 可以轻松部署在 GitLab Pages 上,使用 jupyterlite CLI 并将 output_path 设置为 .gitlab-ci.yml 文件中的 public 文件夹。

假设您的笔记本存储在 content 文件夹中;并且您不需要任何额外的 python 依赖项和配置覆盖,那么 .gitlab-ci.yml 可能如下所示。

image: python
pages:
  stage: deploy
  before_script:
    - python -m pip install jupyterlite-core jupyterlite-pyodide-kernel
  script:
    - jupyter lite build --contents content --output-dir public
  artifacts:
    paths:
      - public # mandatory, other folder won't work
  only:
    - main # the branch you want to publish

提示

如果您正在寻找 JupyterLite GitLab 模板,这里有一个最小示例和一个更复杂的示例