Day 51: Your CI/CD pipeline on AWS --->
Part 2 π β
What is CodeBuild?
- AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy. CodeBuild eliminates the need to provision, manage, and scale your own build servers.
Task-01 :
Read about Buildspec file for Codebuild.
A buildspec is a collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build. You can include a buildspec as part of the source code or you can define a buildspec when you create a build project.
If you include a buildspec as part of the source code, by default, the buildspec file must be named buildspec.yml and placed in the root of your source directory.
Buildspec syntax--->
version: 0.2
phases:
install:
on-failure: ABORT | CONTINUE
commands:
- command
- command
finally:
- command
- command
pre_build:
on-failure: ABORT | CONTINUE
commands:
- command
- command
finally:
- command
- command
build:
on-failure: ABORT | CONTINUE
commands:
- command
- command
finally:
- command
- command
post_build:
on-failure: ABORT | CONTINUE
commands:
- command
- command
finally:
- command
- command
artifacts:
files:
- location
Create a simple index.html file in CodeCommit Repository
You have to build the index.html using nginx server
version: 0.2
phases:
install:
commands:
- echo Installing NGINX
- sudo apt-get update
- sudo apt-get install nginx -y
build:
commands:
- echo Build started on 'date'
- cp index.html /var/www/html/
post_build:
commands:
- echo Configuring NGINX
artifacts:
files:
- "**/*"
Task-02 :
Add
buildspec.yaml
file to CodeCommit Repository and complete the build process.
Happy Learning :)
I hope you enjoyed the task with me :)
Day 51 task is complete!
90DaysOfDevOps Tasksπ
Β