Build & Push Docker Image Using Github Actions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone so in this video i will show you how to use github actions right so what is github action github action is basically an environment where you can build your application all right build your container images right or test your application you can perform unit testing so instead of setting up a junking server and performing the build over there it provides you an environment right where you can basically to the building of your application or even the unit testing of your application right so you don't need a ci server for that basically so to use github action i have already set up a git repository right and this is what the product section looks like it has a application file has a requirement file and it has a docker file we are building a simple docker application simple docker flash base application right where we would be basically printing hello from web magic informatica on the screen whenever this application now this application this python application requires class right and i have defined the flash version or flash library version inside requirement.365 and there's a docker file where i have defined uh the build process how to build this image right so i'm basically downloading a python image right creating a folder setting that folder is working directly then installing the required libraries in our scenario the library reads are defined in deployment.txt file that is a flask library right and i'm copying the application file and finally i'm running flask this is what is happening inside the docker file now i don't want to basically build this thing in my machine right on my local machine or i don't want a jenkins server to build this image right i want github build this image as well as budget image right and we can do this with data action now to basically tell github action what needs to be done with this project folder all right that would be a gift folder dot get a folder and then inside dot data folder there would be a workflow folder and inside the workflow folder you will define a main dot yml file all right this main.yml file is read by github action right and and whatever you have defined it will perform the job for you so in our example what we are trying to do is we are trying to build our image right when the image will will be built whenever there is a pull and push inside the master branch then the github action will be invoked right and what it will do is it will create a ubuntu environment in backend and inside that woman to employment what it will do is it will basically build my image and push it to docker hub all right parent docker up to this registry right now as you can see i am passing some cigarettes right inside this uh command because uh to push the image inside docker hub you will require the password right and i have defined it as a secret instead of defining a password directly over here i have defined it as a cigarette right now how to define this inside data action where will the git of action got to get dissected so that for that what i have done is i've gone to settings up and under segments i have defined a secret over here known as docker password right and i put my docker password over here you can also do the same by just clicking on add write new secret type the secret name and the actual secret whatever you want to store right so whenever the github action will run it will retrieve the secret from you now whenever i do a change it can be any change right whenever i do a change setup action shouldn't move let's do a small change inside this application file let's put our let's put some exclamations over here let me communication whenever i commit these changes if i go to actions a workflow would be involved and this workflow will build my image right and since we have asked it to push the image it will also push the image it has already started happening that is building my image you can see and now it is time to push the image and the build is successful which means my image got built on github right and it has been pushed by github to my docker registry or docker hub so if i go to docker hub and if i refresh this page i should see a new image push just right now few seconds ago right so this is what you can do with github action and this is how you build a docker image using github action right this is it for this video i hope you like it thanks for watching
Info
Channel: WebMagic Informatica - AWS, Azure, GCP & Devops
Views: 22,401
Rating: undefined out of 5
Keywords:
Id: 77nUeNZ2954
Channel Id: undefined
Length: 5min 1sec (301 seconds)
Published: Sun Sep 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.