Skip to content

Commit

Permalink
Create buildspec.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
abdurahim50 authored Jun 16, 2023
1 parent 496dd86 commit 6e943d1
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions buildspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: 0.2

phases:
install:
commands:
- echo Installing app dependencies...
- curl -LO https://dl.k8s.io/release/v1.27.2/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin
- echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc
- source ~/.bashrc
- echo 'Check kubectl version'
- kubectl version --short --client

pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 069279771141.dkr.ecr.us-east-2.amazonaws.com
- IMAGE_REPO_NAME=069279771141.dkr.ecr.us-east-2.amazonaws.com/netflix-app:latest
- IMAGE_TAG=latest
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .



post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $IMAGE_REPO_NAME:$IMAGE_TAG
- aws eks --region us-east-2 update-kubeconfig --name k8s-boy
- echo Push the latest image to cluster
- kubectl apply -f deployment.yml

0 comments on commit 6e943d1

Please sign in to comment.