diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a6915764936a66a02e7732c6c5792e92a3a22fec..ad851645cf830eae8eeb3892ee44731a421e952e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,26 +1,42 @@ name: Docker on: - pull_request: - paths: - - 'Dockerfile' - - '.github/workflows/docker.yml' + push: + branches-ignore: + - 'master' + - 'release**' + - 'backport**' + paths-ignore: + - ".**" -jobs: +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true +jobs: build: runs-on: buildjet-2vcpu-ubuntu-2004 timeout-minutes: 40 steps: + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch - uses: actions/checkout@v2 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build container image - run: docker build -t test-container-image . + run: docker buildx build . -t metabase/metabase-dev:${{ steps.extract_branch.outputs.branch }} --push --compress --no-cache - name: Launch container - run: docker run -dp 3000:3000 test-container-image + run: docker run -dp 3000:3000 metabase/metabase-dev:${{ steps.extract_branch.outputs.branch }} timeout-minutes: 5 - run: docker ps - name: Wait for Metabase to start - run: while ! curl -s localhost:3000/api/health; do sleep 1; done + run: while ! curl -s 'http://localhost:3000/api/health' | grep '{"status":"ok"}'; do sleep 1; done timeout-minutes: 1 - - name: Check API health - run: curl -s localhost:3000/api/health