[英]Google Cloud Build Docker build-arg not respected
我在使用 Google Cloud Build 時遇到問題,其中 docker 構建命令似乎不接受 build-arg 選項,即使此相同命令在本地按預期工作:
Dockerfile:
ARG ASSETS_ENV=development
RUN echo "ASSETS_ENV is ${ASSETS_ENV}"
構建命令:
docker build --build-arg="ASSETS_ENV=production" .
本地結果:
ASSETS_ENV is production
雲構建結果:
ASSETS_ENV is development
確定修復是在雲構建yaml配置中:
之前:
- name: 'gcr.io/cloud-builders/docker'
args: ['build', '--build-arg="ASSETS_ENV=production"', '.']
后:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker build --build-arg="ASSETS_ENV=production" .']
對於像這樣定義他們的步驟的任何人:
- name: 'gcr.io/cloud-builders/docker'
args:
- build
- foo
- bar
@nader-ghanbari的評論對我有用:
- name: 'gcr.io/cloud-builders/docker'
args:
- build
- --build-arg
- TF2_BASE_IMAGE=${_TF2_BASE_IMAGE}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.