Store Docker container images in Artifact Registry

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
uh to create a service account okay you have to first of all open I am an admin okay just click on here okay and go to I am dashboard we will be creating a service account this will be used uh later on our videos so you have to just create a new account okay when you are on I am an admin page just go to service account and here we will create the service account account okay create a service account just give a name uh I will give name YouTube video okay so simple you can just give name tutorial okay so this is how it will be created just create and continue we are not going to give access right now for just uh create it and complete it so our account is created you can see this service account is created okay no we have to just give a one access here just go to the IM am okay so here we will uh ground access to our new account just click on ground access okay you have to select your uh YouTube video service account okay and then here we will just be giving access storage okay okay storage admin okay just give the success and save it okay and here you will see and yeah if you just go back to your service account just click on these three dots manage keys and just create a new key in the jesson file it will download the Jason file we will use this Jason file on our GitHub actions okay okay so just uh save this file okay let me create it my file is now created okay so now we have created our service account this is uh done it is very simple to create a service account on Google Cloud now we have to just add two things which is uh these credentials on our GitHub actions okay and the second thing is we have to add a secret varable which is a Google project name this is my project name okay and I will be just going to you add this on the GitHub actions as well so your project name can be uh different okay so what I'm going to do here okay I will just going to push my code on the GitHub first of all okay this is my project okay uh first update I'm just going to post my code onto the GitHub publish Branch okay public um because I'll be sharing this with you guys so I'm just keeping it public but you can uh keep your uh repo in a private okay I will just open this this is my okay project okay how we have to add this Jon file that we have downloaded just click on settings and go here to the secrets Okay click on actions and here you have to click on new reposit tree secret okay so we will be just uh you know doing this to uh add secret that will be required later on our video okay so I will just going to uh create our first variable which will be Google application credentials okay this is the same uh file Json file that we have uh created I will be just open this file okay and we will just copy the content of this file and I will add this content here it is very simple okay so just let me open this okay so this is the content I will just copy this all the Jon file content okay and I will close this file and I will paste it here simple okay so we have to just save it okay this is our first secret we have to add then we have to add our Google project name okay so I will just click on new Okay Google project okay so if you go your uh Google project and if you click here this is your Google project ID okay just copy this okay ID and paste it simple so we have added our required uh secret okay so what we have done here in this part we done creating our service account and we have done uh adding these secrets into our uh GitHub actions okay okay now what we have to do here we have to add our GitHub actions sell fored Runner using a Google compute engine okay so to create a Google compute engine instance just go to compute engine VM instances here we will create a first instance okay just click on create instance okay just keep these settings simple and here you have to change this uh storage size to 30 GB so I will click on 30 GB I will just update it with the 30 GB okay just select it and save it okay because we will be running some few testing so 10 GB will be very very less so 30 GB will be enough okay next you have to allow uh the traffic HTTP and https just create this instance it's very simple to create instance okay so as our instance is being created okay next what we have to do we have to do SSS to our instance just do SSS to your instance okay so it is going to do SSS to our instance it can you know take um 20 seconds just you have to also wait here authorize it okay so we are now connected okay so I will just make the size bigger so you guys can also see it all right okay I think yeah the size is enough no so we are connected with our instance so now we are going to to do one thing here which is um I can say we are going to add our GitHub uh self hosted Runner to our Google computer engine okay so do this okay you have to just go to your GitHub repo okay I will just go to my GitHub repo okay so if I just go to my GitHub repo in the actions tab just you have to just go to the settings first okay then you have to just go to actions click on Runners add a new selfhosted Runner okay as we're using Linux base instance okay so you have to run these all these commands Okay just um skip this optional command okay so I will be just copying these commands one by one to uh run on my instance to integrate okay my self hosted runner on our instance okay let's copy this first command and you have to just go to your self hosted Runner okay just paste it it will just create a directory okay and secondly you have to copy the second command it will uh download the latest uh runner package okay so then you have to copy the third command okay I just skip this optional okay so just install this uh installer that that is we have downloaded okay so just run this as well okay and the next you have to configure it just copy this command okay when you are done with this command just paste it here okay it will just authenticate here you have to enter few things okay first of all you have to skip and the second you have to enter the name I will just enter VJs uh Google compute okay GC okay simple and then you have to to give just same name VJs GC okay now you can see and also skip this it will by default working directory with this name okay so uh this is configured okay next is uh this step we will run this uh step when we will be uh running our GitHub actions okay uh this is the last step we will use later on okay so by the way we have configured our s fored runner on Google compute engine uh instance okay it is connected it is very simple to connect the Google uh Cloud uh instance okay so you can use um instance to for your self for Runner okay so this is done okay now what we have to do here we are going to do our next step we are going to install Docker on our Linux okay how to install docker first of all I will just clear this okay and so I can go to my uh okay so we will install the docker here okay and then we will uh install uh sonar Cube container and other things so let's first install uh some packages okay I will be just running uh these commands Okay so we have uh um ready to use this okay then I will just try to install JQ as well okay so so just update it I will of course give you article so you can just use these commands Okay so I'm just running these commands uh one by one okay so in the next command we have to install Docker the docker is being installed by the way if I show you my article like how you will uh use my article for the command purposes okay so if I just open My article I think okay uh this is article will be on the LinkedIn okay so suppose I'm installing the docker here okay how I'm installing the docker this is the part of five okay in the part five if I just show you here okay if you can see Docker installation and running sonar Cube container okay so these will be the commands you have to just run okay your Docker will be installed okay so I'm also doing this okay and if I just go back to my uh instance okay next commands Okay now we have to create a username for our Docker I will just give name code with move so you have to give the same name uh like this was my uh you know username this is code with move you have to also give the name whatever your instance name is okay so just code with Mo okay then you have to just start the docker container okay uh sorry docker so and the last command that we have to use here okay so we have run our Docker installation and setup on our Linux instance okay so now we are going to create an artifact registry okay so we can push our image uh to the Google Cloud okay so to create a registry okay you have to first uh I will say you have to go to your uh Google Cloud account okay and here you have to typee artifact registry okay just click on it okay when this page will be open we will create a repository but one thing I have to add here so make sure the API is installed okay uh it mean this API is active I have added this link in my article as well so suppose uh you will need to enable this okay because it's written manage because it's enabled it will be on your side it can be enabled okay so you will just click on enable and it will be enabled so then you can use artifact uh registry to post your images here okay so just uh before we create a repository okay we have to give some permissions as well but yeah let's create a repository then we will uh assign some permission to our Serv account okay so we have then access to push image to our uh repository I will just give name frontend simple okay front end okay just keep it simple uh region whatever you want to choose you can choose uh I will choose us Central one okay so it's up to you which uh region do you want to choose okay so just choose your region okay and if you whatever the region is near with you okay I will just update with my Us West one okay so this region I will be using West 2 this region is not available okay Us West 2 okay this one Los Angeles region okay our Docker image simple okay here you have to just create this simple so our uh repository is being created now okay it is created now what we have to do we have to create we have to give access okay just go to IM okay and here you have to give access to your service account okay uh this was your service account which is available onto the IM Okay so we have to give some uh access okay to give access you can just click on gr access select your service account YouTube video okay and here we will be giving some accesses okay uh I will give the details here first yeah first access name is artifact okay artifact registry admin okay R this is yeah this one we have to I think we just give access to the writer because we don't need admin access simply just click on this access okay if you want to add another access you can also add another role here as well so because we don't need to add any other uh role we don't need to uh add so I will just delete it so simple we're going to just write uh to our our um registry okay so if you want to give full access you can add maybe you can face any problems okay so I will also just give this access sorry artifact registry admin okay so just save just give these two access okay and save it simple okay so we have just given the access okay now what we are going to do here has our um image uh what I will say artifact registry that we have created no we have to create a uh GitHub actions of workflow okay that can build and push our image to the uh here on the artifact registry no you have to just go to your whe Studio code okay and I will be just opening my Wheel Studio code here okay here we go okay done so here you have to create a workflow to dot I will just give name it's a simple name we can give uh build. yml okay so here we have to just uh paste a Content it will be available in my GitHub repo which is in the video description okay I will just use this okay so this is a build workflow okay uh this will be only executed when the first workflow is completed which is a sunar uh code review workflow okay so okay we are using selfhosted and this is the credentials I'm using which I have already added uh on our GitHub okay and then here you see it will authenticate onto the GitHub to the region which is us vest2 if your region is different make sure to replace it okay then we will be using uh tag as a GitHub uh uh uh commit name okay it's a commit hash 5 six digit okay so this will be the for the tag uh so I will be using uh this Varian gab Varian commit Varian name and Google project name which we have already added on the gab ption simply okay so this is my uh you know uh region name okay and then this is um you know key secret okay so simple you can just use it and this was the name of the our artifact registry okay and this is my uh image name okay you can also replace this if your image name is different and this is my tag which I'm using Varan okay uh so simple so it will but just build and push the image to the docker Hub okay so simply I will push it push okay Docker image build post okay so just we will committed before I commit I have to make sure my what I will say I will if I just go to my instance I have to make sure my Runner is running okay so I can just confirm it CD GitHub actions okay and it's going and Dot run Dosh okay so it is a I think I think already running okay listening for the jobs simple so you have to know go and commit the code when the code is commit just go to the GitHub okay here you have to go to the GitHub you will see uh first of all uh it will uh do the review of sunar cube because this is our first workflow when this is successfully completed then it will build our next which is uh would say our Docker image okay so we have to wait as soon as these two uh uh workflows will be completed okay so first is no and the second is a build okay okay and if I just go here okay it is in the process so we have to wait okay so when this is successfully done what you will see here uh if I go to the registry you will see our image will be pushed here okay so we have to just wait okay now you can see um sonar code review is done now it is you know U building our Docker image and pushing to the docker Hub okay it is executing all the steps one by one okay authenticating and it will install Cube CDL okay and it will do all these steps okay so we have to wait uh till this is completed okay so almost it is done and you can see images being posted to the artifact registry just go and refresh it okay just refresh it okay so you can see our image is here this was my image name okay so you can see and this is our image which is the T tag which was foran it is it is also posted so we are done with this uh image uh building and pushing to the artifact
Info
Channel: CodeWithMuh
Views: 341
Rating: undefined out of 5
Keywords: how to push docker image to google artifact registry, Artifact Registry, Store Docker container images in Artifact Registry, push docker image to artifact registary, google cloud artifact registry, kubernetes private docker registry, docker, github, github actions, vuejs
Id: mjHxmaE68II
Channel Id: undefined
Length: 21min 39sec (1299 seconds)
Published: Mon Feb 12 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.