Skip to content

Code Build Workflow

Code Build Workflow #1

Workflow file for this run

name: Code Build Workflow
on:
workflow_run:
workflows:
- Sonar Code Review Workflow
types:
- completed
jobs:
build:
name: Build
# runs-on: ubuntu-latest -- Used to run on Github hosting
runs-on: self-hosted
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Docker build and push
run: |
docker build -t react-aws-eks-github-actions .
docker tag react-aws-eks-github-actions codewithmuh/react-aws-eks-github-actions:latest
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker push codewithmuh/react-aws-eks-github-actions:latest
env:
DOCKER_CLI_ACI: 1
- name: Pull the Docker image On AWS EC2 For tetsing of website
run: docker pull sevenajay/tic-tac-toe:latest
- name: Stop and remove existing container
run: |
docker stop react-aws-eks-github-actions || true
docker rm react-aws-eks-github-actions || true
- name: Run the container on AWS EC2 for testing
run: docker run -d --name react-aws-eks-github-actions -p 3000:3000 codewithmuh/react-aws-eks-github-actions:latest