Google 另一个路径中的 Cloud Build 安装卷
Google Cloud Build mount volume in another path
在本地我 运行 这个命令是为了构建一个 PDF 文件:
docker run -it -v $PWD:/doc/ -v $PWD/fonts/:/usr/share/fonts/external/ thomasweise/texlive sh -c 'xelatex *.tex'
我有一个 cloudbuild.yaml
文件要在 Google Cloud
上构建
steps:
- name: thomasweise/texlive
entrypoint: sh
args:
- -c
- |
xelatex *.tex
- name: gcr.io/cloud-builders/gsutil
args: ["cp", "*.pdf", "gs://storage.skhaz.io"]
但是我的构建失败了,因为我需要安装一个额外的卷:-v $PWD/fonts/:/usr/share/fonts/external/
如何将上面的命令翻译成 cloudbuild.yaml
?
正如您在 the documentation 中看到的,您可以通过 2 个步骤实现此目的
#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'
在本地我 运行 这个命令是为了构建一个 PDF 文件:
docker run -it -v $PWD:/doc/ -v $PWD/fonts/:/usr/share/fonts/external/ thomasweise/texlive sh -c 'xelatex *.tex'
我有一个 cloudbuild.yaml
文件要在 Google Cloud
steps:
- name: thomasweise/texlive
entrypoint: sh
args:
- -c
- |
xelatex *.tex
- name: gcr.io/cloud-builders/gsutil
args: ["cp", "*.pdf", "gs://storage.skhaz.io"]
但是我的构建失败了,因为我需要安装一个额外的卷:-v $PWD/fonts/:/usr/share/fonts/external/
如何将上面的命令翻译成 cloudbuild.yaml
?
正如您在 the documentation 中看到的,您可以通过 2 个步骤实现此目的
#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'