From cf28c7fae7f26742e0eebc00f5ef8e4125e1992c Mon Sep 17 00:00:00 2001 From: zzzm1lo <160062868+zzzm1lo@users.noreply.github.com> Date: Sun, 26 May 2024 23:28:21 -0400 Subject: [PATCH 1/3] Create main.yml --- .github/workflows/main.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..9d1758c3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,45 @@ +name: Deploy to ECR +# updated ECR Repo week3-1 +on: + push: + branches: [ master ] + +jobs: + + build: + + name: Build Image + runs-on: ubuntu-latest + + + steps: + + - name: Check out code + uses: actions/checkout@v4 + + - 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 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: clo835-week3-1 + IMAGE_TAG: v0.1 + run: | + cd Chapter02/kubia/ + ls -ltra + # Docker build command + 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 cd143aa1a18b0eac8f859b666a6ddaca2221adf3 Mon Sep 17 00:00:00 2001 From: zzzm1lo <160062868+zzzm1lo@users.noreply.github.com> Date: Mon, 27 May 2024 00:18:38 -0400 Subject: [PATCH 2/3] Delete .github/workflows/main.yml --- .github/workflows/main.yml | 45 -------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 9d1758c3..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Deploy to ECR -# updated ECR Repo week3-1 -on: - push: - branches: [ master ] - -jobs: - - build: - - name: Build Image - runs-on: ubuntu-latest - - - steps: - - - name: Check out code - uses: actions/checkout@v4 - - - 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 - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: clo835-week3-1 - IMAGE_TAG: v0.1 - run: | - cd Chapter02/kubia/ - ls -ltra - # Docker build command - 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 095918fab72a0f722b1149c9667acd3786f9e1df Mon Sep 17 00:00:00 2001 From: zzzm1lo <160062868+zzzm1lo@users.noreply.github.com> Date: Mon, 27 May 2024 00:18:58 -0400 Subject: [PATCH 3/3] Create main.yml --- .github/workflows/main.yml | 45 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..9d1758c3 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,45 @@ +name: Deploy to ECR +# updated ECR Repo week3-1 +on: + push: + branches: [ master ] + +jobs: + + build: + + name: Build Image + runs-on: ubuntu-latest + + + steps: + + - name: Check out code + uses: actions/checkout@v4 + + - 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 + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: clo835-week3-1 + IMAGE_TAG: v0.1 + run: | + cd Chapter02/kubia/ + ls -ltra + # Docker build command + 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