Docker Cookbook


Setting Up an Automated Build on Docker Hub for Continuous Integration/Deployment | 65



Download 6,31 Mb.
Pdf ko'rish
bet61/260
Sana21.04.2022
Hajmi6,31 Mb.
#570749
1   ...   57   58   59   60   61   62   63   64   ...   260
Bog'liq
Docker Cookbook

2.12 Setting Up an Automated Build on Docker Hub for Continuous Integration/Deployment | 65


delivery pipeline. In the Build Details page of your automated build, you will be able
to access the Web Hooks page. In it you can add URLs that will receive an HTTP
POST when a successful build happens. The body of this POST request will contain a
callback URL. In response, you will need to send another HTTP POST with a JSON
payload containing the 
state
key and the value of either 
success

failure
, or 
error
.
On receiving a successfull state, the automated build can call another webhook,
henceforth allowing you to chain several actions together.
See Also
• The automated build 
reference
 documentation
2.13 Setting Up a Local Automated Build by Using a Git
Hook and a Private Registry
Problem
Automated builds using Docker Hub and GitHub or Bitbucket are great (see 
Recipe
2.12
), but you might be using a private registry (i.e., local hub) and may want to trig‐
ger Docker builds when you commit to your local Git projects.
Solution
Create a 
post-commit
Git hook that triggers a build and pushes the new image to
your private registry.
In the root tree of your Git project, create a bash script, 
./git/hooks/post-commit
, that
contains something as simple as this:
#!/bin/bash
tag=`git log -1 HEAD --format="%h"`
docker build -t flask:$tag /home/sebgoa/docbook/examples/flask
Make it executable with 
chmod +x .git/hooks/post-commit
.
Now every time you make a commit to this Git project, this 
post-commit
bash script
will run. It will create a 
tag
using the short version of the SHA of the latest commit
and then trigger the build based on the Dockerfile referenced. It will then create a
new image with the name 
flask
and the computer tag:
$ git commit -m "fixing hook"
9c38962
Sending build context to Docker daemon 3.584 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:14.04

Download 6,31 Mb.

Do'stlaringiz bilan baham:
1   ...   57   58   59   60   61   62   63   64   ...   260




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish