From f8183b1314664345ec955c1deb9c5a482fa0b0c7 Mon Sep 17 00:00:00 2001 From: Antoine Lavenant Date: Mon, 15 Jul 2024 15:07:17 +0200 Subject: [PATCH] update docker build --- .github/workflows/cicd_docker.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cicd_docker.yml b/.github/workflows/cicd_docker.yml index 46b5534..c8e1b76 100644 --- a/.github/workflows/cicd_docker.yml +++ b/.github/workflows/cicd_docker.yml @@ -24,9 +24,15 @@ jobs: - name: Checkout branch uses: actions/checkout@v4 - # build "local" and test before build and deploy - - name: Build docker image - run: docker build -t ${{ env.DOCKER_IMAGE_NAME }}:test . + # build the image + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@v5 + with: + load: true + tags: test + + # run the test on the docker build - name: Run tests in docker image run: docker run ${{ env.DOCKER_IMAGE_NAME }}:test python -m pytest @@ -43,6 +49,7 @@ jobs: # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action - name: Extract Docker metadata + if: github.event_name != 'pull_request' id: meta uses: docker/metadata-action@v5 with: @@ -59,13 +66,3 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - # pull and test - - name : Pull Docker image - id: pull-image - if: github.event_name != 'pull_request' - run: docker pull ${{ steps.meta.outputs.tags }} - - name : Test Docker image - id: test-image - if: github.event_name != 'pull_request' - run: docker run ${{ steps.meta.outputs.tags }} python -m pytest