在travis-ci中,如果更改dockerfile或install.sh,如何构建docker镜像?
注意:install.sh会安装依赖项。它包含dockerfile的RUN命令使用的长命令列表。
答案 0 :(得分:1)
$(git diff --name-only ${TRAVIS_COMMIT_RANGE} | grep docker/Dockerfile > /dev/null)
dockerfile_status=$?
$(git diff --name-only ${TRAVIS_COMMIT_RANGE} | grep scripts/linux/bootstrap.sh > /dev/null)
bootstrap_status=$?
if [[ ${dockerfile_status} == "0" || ${bootstrap_status} == "0" ]]
then
echo "New docker image is required, building new image"
else
echo "New docker image is not required"
fi