From 309ab370fceacc8f3f86edc749043466f152e275 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Wed, 11 Dec 2024 20:36:40 +0700 Subject: [PATCH] fix: Add docker docker build and curl check --- .github/workflows/build.yml | 30 ++++++++++++++++++++++++++++-- scripts/wait-for.sh | 13 +++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 scripts/wait-for.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e50c716..47739e95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - build: + binary: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -18,4 +18,30 @@ jobs: go-version: 1.22 - name: Build App - run: make eigenda-proxy \ No newline at end of file + run: make eigenda-proxy + + docker: + runs-on: ubuntu-latest + steps: + - name: Build container + uses: docker/build-push-action@v4 + with: + context: . + push: false + tag: eigenda-proxy + + - name: Run container as background process + shell: bash + run: | + docker run -d \ + -p 4242:6666 \ + -e EIGENDA_PROXY_ADDR=0.0.0.0 \ + -e EIGENDA_PROXY_PORT=6666 \ + -e EIGENDA_PROXY_MEMSTORE_ENABLED=true \ + -e EIGENDA_PROXY_EIGENDA_CERT_VERIFICATION_DISABLED=true \ + eigenda-proxy + + - name: Wait for rpc to come up + shell: bash + run: | + ${{ github.workspace }}/scripts/wait-for.sh \ No newline at end of file diff --git a/scripts/wait-for.sh b/scripts/wait-for.sh new file mode 100644 index 00000000..eabd3b4e --- /dev/null +++ b/scripts/wait-for.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# poll the proxy endpoint until we get a 0 return code or 5mins have passed, in that case exit 1 +timeout_time=$(($(date +%s) + 300)) + +while (( $(date +%s) <= timeout_time )); do + if curl -X GET 'http://localhost:6969/health'; then + exit 0 + else + sleep 20 + fi +done + +exit 1 \ No newline at end of file