Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add Docker images testing #3943

Merged
merged 8 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ jobs:
targets: base
push: true

- name: Test base images
run: |
EXPECTED_VERSION=$(cat VERSION.txt)
VERSION=$(docker run --rm deepset/haystack-base-cpu-${{ steps.meta.outputs.version }} --platform linux/amd64 python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]]
VERSION=$(docker run --rm deepset/haystack-base-gpu-${{ steps.meta.outputs.version }} --platform linux/amd64 python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]]
VERSION=$(docker run --rm deepset/haystack-base-cpu-${{ steps.meta.outputs.version }} --platform linux/arm64 python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]]
VERSION=$(docker run --rm deepset/haystack-base-gpu-${{ steps.meta.outputs.version }} --platform linux/arm64 python -c"import haystack; print(haystack.__version__)")
[[ "$VERSION" = "$EXPECTED_VERSION" ]]

- name: Build api images
uses: docker/bake-action@v2
env:
Expand Down Expand Up @@ -89,3 +101,13 @@ jobs:
workdir: docker
targets: api-latest
push: true

- name: Test api image no version in tag
if: steps.version.outputs.comparison-result == '>'
run: |
docker compose up -d
# Waits for containers to come up
sleep 15s
EXPECTED_VERSION=$(cat VERSION.txt)
VERSION=$(curl http://localhost:8000/hs_version | jq .hs_version)
[[ "$VERSION" = "$EXPECTED_VERSION" ]]
4 changes: 2 additions & 2 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG build_image
ARG base_immage
ARG base_image

FROM $build_image AS build-image

Expand Down Expand Up @@ -35,7 +35,7 @@ RUN pip install --upgrade pip && \
pip install --no-cache-dir ./rest_api


FROM $base_immage AS final
FROM $base_image AS final

COPY --from=build-image /opt/venv /opt/venv
COPY --from=build-image /opt/pdftotext /usr/local/bin
Expand Down
4 changes: 2 additions & 2 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ target "base-cpu" {
tags = ["${IMAGE_NAME}:base-cpu-${IMAGE_TAG_SUFFIX}"]
args = {
build_image = "python:3.10-slim"
base_immage = "python:3.10-slim"
base_image = "python:3.10-slim"
haystack_version = "${HAYSTACK_VERSION}"
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores,crawler,preprocessing,ocr,onnx,beir]"
}
Expand All @@ -57,7 +57,7 @@ target "base-gpu" {
# pytorch/pytorch:1.13.1-cuda11.6 ships Python 3.10.8

build_image = "pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime"
base_immage = "pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime"
base_image = "pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime"
haystack_version = "${HAYSTACK_VERSION}"
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores-gpu,crawler,preprocessing,ocr,onnx-gpu]"
}
Expand Down