Google Cloud 在另一个路径中构建挂载卷

Skh*_*haz 3 google-cloud-platform google-cloud-build

我在本地运行此命令以构建 PDF 文件:

docker run -it -v $PWD:/doc/ -v $PWD/fonts/:/usr/share/fonts/external/ thomasweise/texlive sh -c 'xelatex *.tex'
Run Code Online (Sandbox Code Playgroud)

我有一个cloudbuild.yaml要在 Google Cloud 上构建的文件

docker run -it -v $PWD:/doc/ -v $PWD/fonts/:/usr/share/fonts/external/ thomasweise/texlive sh -c 'xelatex *.tex'
Run Code Online (Sandbox Code Playgroud)

但我的构建失败了,因为我需要安装额外的卷:-v $PWD/fonts/:/usr/share/fonts/external/

如何将上面的命令翻译为cloudbuild.yaml

gui*_*ere 6

正如您在文档中看到的,您可以通过两个步骤来实现这一点

#1st step: Create the volume and populate it
- name: 'gcr.io/cloud-builders/gcloud'
  volumes:
  - name: 'vol1'
    path: '/usr/share/fonts/external'
  entrypoint: 'bash'
  args:
  - '-c'
  - |
        cp /workspace/path/to/fonts/* /usr/share/fonts/external/

# Then, use the volume with your fonts in it
- name: thomasweise/texlive
    entrypoint: sh
    args:
      - -c
      - |
        xelatex *.tex
  volumes:
  - name: 'vol1'
    path: '/usr/share/fonts/external'
Run Code Online (Sandbox Code Playgroud)