Add load arg to docker/bake-action before testing Docker images (#4124)

This commit is contained in:
Silvano Cerza 2023-02-10 17:41:27 +01:00 committed by GitHub
parent 27aaa92800
commit d9a7e8011f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ on:
branches:
- main
tags:
- 'v[0-9].[0-9]+.[0-9]+*'
- "v[0-9].[0-9]+.[0-9]+*"
env:
DOCKER_REPO_NAME: deepset/haystack
@ -45,18 +45,20 @@ jobs:
with:
workdir: docker
targets: base
load: true
push: true
- name: Test base images
run: |
EXPECTED_VERSION=$(cat VERSION.txt)
function test_image {
local TAG=$1
local PLATFORM=$2
local VERSION=$(docker run --platform $PLATFORM --rm deepset/haystack:$TAG python -c"import haystack; print(haystack.__version__)")
local TAG, PLATFORM, VERSION
TAG=$1
PLATFORM=$2
VERSION=$(docker run --platform "$PLATFORM" --rm "deepset/haystack:$TAG" python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]] || echo "::error 'Haystack version in deepset/haystack:$TAG image for $PLATFORM is different from expected'"
# Remove image after test to avoid filling the GitHub runner and prevent its failure
docker rmi deepset/haystack:$TAG
docker rmi "deepset/haystack:$TAG"
}
test_image base-cpu-${{ steps.meta.outputs.version }} linux/amd64
test_image base-gpu-${{ steps.meta.outputs.version }} linux/amd64
@ -104,6 +106,7 @@ jobs:
with:
workdir: docker
targets: api-latest
load: true
push: true
- name: Test api image no version in tag