From f40b557867ba973fc3062be2d4c1821fd30669b1 Mon Sep 17 00:00:00 2001 From: Marko Atanasievski Date: Thu, 27 Jun 2024 11:28:54 +0200 Subject: [PATCH] feat: add docker build test --- .github/workflows/docker_build.yml | 27 +++++++++++++++++++ ...r-build-push.yml => docker_build_push.yml} | 13 +++++---- 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/docker_build.yml rename .github/workflows/{docker-build-push.yml => docker_build_push.yml} (93%) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml new file mode 100644 index 000000000..61ac8e4c6 --- /dev/null +++ b/.github/workflows/docker_build.yml @@ -0,0 +1,27 @@ +name: Docker Build & Run + +on: + push: + branches: [develop, main] + pull_request: + branches: + - "**" + workflow_dispatch: + branches: + - "**" + +jobs: + docker: + name: Build and run for sanity check leader and worker docker images + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build leader docker container + run: | + docker build --progress plain -t leader:${{ github.ref_name }} -f leader.Dockerfile . + + - name: Run leader docker container + run: | + docker run -it leader:${{ github.ref_name }} --help \ No newline at end of file diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker_build_push.yml similarity index 93% rename from .github/workflows/docker-build-push.yml rename to .github/workflows/docker_build_push.yml index 2c94e6a53..2489b61b9 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker_build_push.yml @@ -1,14 +1,17 @@ -name: Docker_build_push +name: Docker Build & Push on: push: - branches: [develop] + branches: [develop, main] release: types: [created] # TODO to debug build and push, remove before merge pull_request: branches: [develop] + + + env: REGISTRY: ghcr.io IMAGE_NAME_LEADER: ${{ github.repository }}-leader @@ -16,7 +19,7 @@ env: jobs: docker: - name: Build and push leader and worker docker image to GitHub Container Registry + name: Build and push leader and worker docker images to GitHub Container Registry runs-on: ubuntu-latest permissions: packages: write @@ -42,7 +45,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LEADER }}, enable=true + name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LEADER }} tags: | type=ref,event=branch type=ref,event=pr @@ -66,7 +69,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_WORKER }}, enable=false + name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_WORKER }} tags: | type=ref,event=branch type=ref,event=pr