From 9ef96f3ef90f50ac802c5d29013c4f6480ff8e9e Mon Sep 17 00:00:00 2001 From: tituschewxj Date: Tue, 8 Oct 2024 18:54:14 +0800 Subject: [PATCH] chore: add docker build --- .github/workflows/docker-build.yml | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000000..134fc1242b --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,42 @@ +name: Docker Compose Pipeline + +on: + push: + branches: + - main + - staging + pull_request: + branches: + - main + - staging + +jobs: + test: + runs-on: ubuntu-latest + + services: + docker: + image: docker:19.03.12 + options: --privileged + ports: + - 8080:8080 + volumes: + - /var/run/docker.sock:/var/run/docker.sock + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Compose + run: sudo apt-get update && sudo apt-get install docker-compose -y + + - name: Build and Run Services + run: docker-compose up --build -d + + - name: Wait for services to be ready + run: sleep 10 # this is the estimated service startup time + + - name: Run Tests + run: | + curl --fail http://localhost:3000 # Adjust based on the app + # You can add more tests here