From b65e4875eeb9bbc462fe263dae91dddf32342ffd Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Tue, 3 Dec 2024 02:19:29 +0200 Subject: [PATCH] fix: determine the correct Docker socket from the context --- .github/actions/build-docker-image/action.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-docker-image/action.yml b/.github/actions/build-docker-image/action.yml index c2cb8de7..532f9ebe 100644 --- a/.github/actions/build-docker-image/action.yml +++ b/.github/actions/build-docker-image/action.yml @@ -95,9 +95,6 @@ runs: env: SOURCE_DATE_EPOCH: 0 - - run: docker context ls - shell: bash - - name: Get image name shell: bash id: imagename @@ -154,11 +151,16 @@ runs: echo "hash=" >> "${GITHUB_OUTPUT}" fi + - name: Get Docker socket + id: socket + run: echo docker_socket="$(docker context ls --format json | jq -r 'select(.Current == true) | .DockerEndpoint' | sed 's!^unix://!!')" >> "${GITHUB_OUTPUT}" + shell: bash + - name: Security Scan shell: bash run: | docker run --rm \ - -v /var/run/docker.sock:/var/run/docker.sock \ + -v ${{ steps.socket.outputs.docker_socket }}:/var/run/docker.sock \ -v $(pwd)/.cache:/root/.cache \ -v $(pwd):/workdir \ -w /workdir \