version: 2.1

jobs:
  build:
    machine:
      image: ubuntu-2204:2023.07.2
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: |
            sudo apt install awscli
            sudo chmod +x ./script.sh
      - run: 
          name: Build image and push
          command: ./script.sh $CIRCLE_SHA1
workflows:
  build_push:
    jobs:
      - build:
          context: AWS
          filters:
            branches:
              only:
                - main