我在使用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
build-arg
分成两个参数传递吗?例如args: [ "build", "--build-arg", "ASSET_ENV=production", ...]
。我有一个类似的设置,它可以正常工作。args: ["build","--build-arg", "TF2_BASE_IMAGE=${_TF2_BASE_IMAGE}" ...]
- Nader Ghanbari