Docker ~ Do not use yml for batch deployment service, dockeryml for deployment

Source: Internet
Author: User

Docker ~ Do not use yml for batch deployment service, dockeryml for deployment

Sometimes, in a continuous integration environment, sometimes the yml environment does not exist. It may only provide docker tools, but docker-compose may not be provided, in this way, if we want to automatically build all the projects under the solution, we need to write the sh script, and we need to write the projects that need to be packaged, released, and mirrored into our array, then traverse it!

1. Restore and release projects in batches

#! /Bin/sh # declare the project declare-a projectList = ('.. /Beijing. tax ''.. /Jiangsu. tax ') # recover package dependency and release for project in "$ {projectList [@]}" do echo-e "\ e [33 mWorking on $ (pwd) /$ project "echo-e" \ e [33m \ tRemoving old publish output "pushd $ (pwd) /$ project rm-rf obj/Docker/publish echo-e "\ e [33m \ tRestoring project" dotnet restore echo-e "\ e [33m \ tBuilding and publishing projects" dotnet publish-o obj/Docker/publish popddone

Ii. generate images in batches

#! /Bin/sh export Registry_Url = "ciregistry.i-counting.cn: 8443" # declare the project declare-a projectList = ('.. /Beijing. tax, lind/bejing. tax ''.. /Jiangsu. tax, lind/jiangsu. tax ') for project in "$ {projectList [@]}" doarr = ($ {project //,/}) dir =$ {arr [0]} image =$ {arr [1]} echo "dir" echo $ dirpushd $ (pwd) /$ dirdocker build -- no-cache -- pull-t $ image. /docker tag $ image $ Registry_Url/$ image # docker push $ Registry_Url/$ imagedone

Then we can use docker images "lind/*" to view all image files starting with lind.

Generally, all our scripts are placed in the root directory of the solution, create a deploy, and put the automation script in.

Thank you for reading this article!

Sometimes, there may be a variety of ways to achieve one goal. You can choose one that suits us!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.