From e9ba625c0da1b425fa2286fd1842a8c4604697a0 Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:36:36 -0400 Subject: [PATCH 1/7] Created push_image_to_ecr --- .github/workflows/push_image_to_ecr | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/push_image_to_ecr diff --git a/.github/workflows/push_image_to_ecr b/.github/workflows/push_image_to_ecr new file mode 100644 index 0000000..b87dacc --- /dev/null +++ b/.github/workflows/push_image_to_ecr @@ -0,0 +1,42 @@ +name: Deploy Image to ECR + +on: + push: + branches: [ master ] + +jobs: + + build: + + name: Build Image + runs-on: ubuntu-latest + + steps: + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Login into Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} + AWS_REGION: us-east-1 + + - name: build,test,tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: clo835-week3 + IMAGE_TAG: v0.1 + run: | + cd Chapter02/kubia/ + ls -ltra + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker run -d -p 80:8080 --name nodeapp $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker ps + echo "Pause for 10 seconds to let the container start" + sleep 10 + curl localhost -vvv + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG From fd129911de9a2091c9ae4e841d315cea0b84cd1e Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:45:40 -0400 Subject: [PATCH 2/7] Update --- .github/workflows/push_image_to_ecr | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/push_image_to_ecr b/.github/workflows/push_image_to_ecr index b87dacc..a0048a7 100644 --- a/.github/workflows/push_image_to_ecr +++ b/.github/workflows/push_image_to_ecr @@ -13,30 +13,30 @@ jobs: steps: - - name: Checkout Code - uses: actions/checkout@v3 + - name: Checkout Code + uses: actions/checkout@v3 - - name: Login into Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} - AWS_REGION: us-east-1 + - name: Login into Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} + AWS_REGION: us-east-1 - - name: build,test,tag, and push image to Amazon ECR - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: clo835-week3 - IMAGE_TAG: v0.1 - run: | - cd Chapter02/kubia/ - ls -ltra - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker run -d -p 80:8080 --name nodeapp $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker ps - echo "Pause for 10 seconds to let the container start" - sleep 10 - curl localhost -vvv - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + - name: build,test,tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: clo835-week3 + IMAGE_TAG: v0.1 + run: | + cd Chapter02/kubia/ + ls -ltra + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker run -d -p 80:8080 --name nodeapp $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker ps + echo "Pause for 10 seconds to let the container start" + sleep 10 + curl localhost -vvv + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG From d1b09b79c177552433a41501da1e53b35f6b0035 Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:48:47 -0400 Subject: [PATCH 3/7] Update DockerFile --- Chapter02/kubia/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Chapter02/kubia/Dockerfile b/Chapter02/kubia/Dockerfile index c70e4c8..b9e0944 100644 --- a/Chapter02/kubia/Dockerfile +++ b/Chapter02/kubia/Dockerfile @@ -1,4 +1,5 @@ FROM node:7 ADD app.js /app.js +#This is the entrypoint of the Node ENTRYPOINT ["node", "app.js"] From e9fa5e1b3dcfb3bbc62a6b26595425c7e30a0162 Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:52:40 -0400 Subject: [PATCH 4/7] Updated file --- .github/workflows/push_image_to_ecr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/push_image_to_ecr b/.github/workflows/push_image_to_ecr index a0048a7..1513541 100644 --- a/.github/workflows/push_image_to_ecr +++ b/.github/workflows/push_image_to_ecr @@ -7,7 +7,7 @@ on: jobs: build: - + #THis is the workflow to build the image name: Build Image runs-on: ubuntu-latest From b49e4dc4db0f0bd5dd18991856ed247ca33834aa Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 19:55:50 -0400 Subject: [PATCH 5/7] Updated File --- .github/workflows/push_image_to_ecr | 53 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/.github/workflows/push_image_to_ecr b/.github/workflows/push_image_to_ecr index 1513541..e0e7ac6 100644 --- a/.github/workflows/push_image_to_ecr +++ b/.github/workflows/push_image_to_ecr @@ -1,42 +1,45 @@ -name: Deploy Image to ECR +name: Deploy to ECR -on: +on: push: branches: [ master ] - + jobs: build: - #THis is the workflow to build the image + name: Build Image runs-on: ubuntu-latest + steps: - - - name: Checkout Code - uses: actions/checkout@v3 - - name: Login into Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v1 - env: + - name: Check out code + uses: actions/checkout@v2 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SESSION_TOKEN: ${{ secrets.AWS_SESSION_TOKEN }} AWS_REGION: us-east-1 - - - name: build,test,tag, and push image to Amazon ECR + + - name: Build, test, tag, and push image to Amazon ECR env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: clo835-week3 - IMAGE_TAG: v0.1 + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: clo835-week3 + IMAGE_TAG: v0.1 run: | - cd Chapter02/kubia/ - ls -ltra - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker run -d -p 80:8080 --name nodeapp $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker ps - echo "Pause for 10 seconds to let the container start" - sleep 10 - curl localhost -vvv - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + cd Chapter02/kubia/ + ls -ltra + # Docker build + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + # Unit test + docker run -d -p 80:8080 --name nodeapp $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker ps + echo "Pause for 10 seconds to let container start" + sleep 10 + curl localhost -vvv + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG From ff763842732a7646da4c8ae621a8fcc7afa2ffd4 Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 20:02:04 -0400 Subject: [PATCH 6/7] Add files via upload --- key.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 key.txt diff --git a/key.txt b/key.txt new file mode 100644 index 0000000..2c12025 --- /dev/null +++ b/key.txt @@ -0,0 +1 @@ +HH03H-VGJDP-P8LJA-0HCRM-AD1P0 \ No newline at end of file From 342f9fca9acc16a8977b2ab6f744d48cdfec55fd Mon Sep 17 00:00:00 2001 From: Tirth Patel <46216376+patel7147@users.noreply.github.com> Date: Wed, 1 Jun 2022 20:04:09 -0400 Subject: [PATCH 7/7] Rename push_image_to_ecr to push_image_to_ecr.yml --- .github/workflows/{push_image_to_ecr => push_image_to_ecr.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{push_image_to_ecr => push_image_to_ecr.yml} (100%) diff --git a/.github/workflows/push_image_to_ecr b/.github/workflows/push_image_to_ecr.yml similarity index 100% rename from .github/workflows/push_image_to_ecr rename to .github/workflows/push_image_to_ecr.yml