name: Build Docker Image
run-name: Build Docker Image 
on: [push]

jobs:
  Build Docker Image:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
      - name: Install system dependencies
        run: |
          # change mirror to kku.ac.th for faster package downloading
          sudo sed -i 's@http://archive.ubuntu.com@http://mirror.kku.ac.th@g' /etc/apt/sources.list.d/ubuntu.sources
          sudo apt update && sudo apt install nodejs npm curl -y
      - name: Install project dependencies
        run: |
          npm install
      - name: Testing APIs
        run: |
          chmod +x test.sh
          ./test.sh
      - name: Build docker image
        run: |
          docker build . -t accounting-api:latest
          
          