Simple CI CD with GCP Cloud Build using Docker- part 1
I believe everyone will absolutely like the concept of automation. Those are some concepts that will help our messy lives or give us extra time to do things.
like Tesla cars, if you want to go somewhere just need to do some settings and the car will run automatically.
Or if you have an injured spine, it’s like a massage chair that will cheer you up.
So everyone like automation, even in our frustrating job.
Like every time push GitHub, test, deploy, etc...
Many articles on Medium already talk about it and bring joy to us.
And I want to share my little note to do some CI/CD with nodejs & GCP, hopefully, can help you at the correct time
if you create some App with Javascript event for Frontend or Backend. GCP has many interesting services for you.
It will be the same as using an API Gateway, Lambda, etc in AWS.
To do this in GCP we need to use some services like:
- Cloud run for hosting our app
- Cloud build for doing some automation for us
- A repository for storing our code like GitHub
- And also the .yaml file to specify our command
Open the GCP dashboard -> Cloud Build and create some triggers.
Fill in the name and description for our build, like amazing_app-DEV, amazing_app-PROD, etc if you want to specify the build for every environment. Also checklist the “Push to a branch” in the Event section. This will specify our Cloud Build to do some pipeline every time a new code is pushed into our selected branch. Don't forget to select the nearest region from your current location.
after that, scroll to the bottom a little bit, and select your repository and the branch.
We can use a cloud repository or another repository like GitHub or BitBucket.
Since we will specify our command pipeline in the .yaml file (*we have not yet created it), we need to checklist “Cloud Build configuration file (yaml or json)” and checklist the “Repository” in the location section.
Make sure you put a correct name file same as your .yaml file in your current directory project
This will be telling our Cloud Build to look at a command list in the .yaml file in our root directory project.
After that, Save our cloud build and grab some drink…