Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 36 lines (31 sloc) 1.35 KB
# Customize here
export TF_VAR_compartment_ocid=ocid1.compartment.oc1..aaaaaaaavpjjlshvlm7nh6gxuhbsdzdbvhuiihenvyaqz6o4hrycscjtq75q
# Provisioning image building VM
export TF_VAR_custom_image_shape="$custom_image_shape"
export TF_VAR_custom_image_base="$custom_image_base"
cd infrastructure
terraform init
echo "IB: Provisioning image building infrastructure"
terraform apply -auto-approve 2>&1 | tee ../terraform.out
vm_ip=`cat ../terraform.out | grep image_builder_vm_public_ip | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+'`
vm_ocid=`cat ../terraform.out | grep image_builder_vm_ocid | awk '{print $3}'`
echo "IB ip: $vm_ip ocid: $vm_ocid"
cd ..
echo "IB: Waiting for SSH on VM"
# Executing custom image specific scripts
echo "IB: Executing image building script"
ssh -i keys/oci_id_rsa -o StrictHostKeyChecking=no -l opc $vm_ip "bash -s" < scripts/
echo "IB: Ready"
# Creating an image
oci compute image create --display-name $custom_image_name --instance-id "$vm_ocid" --wait-for-state AVAILABLE
# Terminating the image building VM
cd infrastructure
terraform destroy -auto-approve
unset TF_VAR_custom_image_shape
unset TF_VAR_custom_image_base
unset TF_VAR_compartment_ocid
You can’t perform that action at this time.