您可以在子外壳(...)
中调用命令:
(
cd ./folder_02
docker build . -t image_name
)
(
cd ./folder_03
something else
)
在要保留环境的脚本中,我使用pushd
+ popd
。
pushd ./folder_02 >/dev/null
docker build . -t image_name
popd >/dev/null
pushd ./folder_03 >/dev/null
something soemthing
popd >/dev/null
,
您可以像@KamilCuk所说的那样使用子外壳client = boto3.client('ssm',region_name='eu-west-2')
commands = ['echo "hello world" > hello.txt'] #this would be replaced by the command to execute the python script
instance_id = [id] #id being the instance id established from above
response = client.send_command(DocumentName='AWS-RunShellScript',Parameters= 'commands':commands},InstanceIds=instance_id,)
(...)
或
(cd ../folder_02 && docker build . -t image_name )
(cd ../folder_03 && something else)
从Docker开始,您可以使用-f参数选择要使用的Dockerfile:
(cd ../folder_02; docker build . -t image_name )
(cd ../folder_03; something else)
本文链接:https://www.f2er.com/2295159.html