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

refactoring: reimplement Docker strategy #3162

Merged
merged 21 commits into from
Sep 12, 2022
Merged

refactoring: reimplement Docker strategy #3162

merged 21 commits into from
Sep 12, 2022

Conversation

masci
Copy link
Contributor

@masci masci commented Sep 5, 2022

Related Issues

Related to #1952

Proposed Changes:

This PR contains several improvements to our Docker images and we can group the changes under 2 main topics.

New tagging strategy

Right now we offer different images for different image variants, e.g. haystack-cpu, haystack-gpu. After this PR we'll have one image, deepset/haystack properly tagged to indicate the version and the variant, e.g. deepset/haystack:gpu-1.9.0. This will be the new tags layout:

  • cpu, cpu-1.10.0
  • cpu-1.10.0
  • gpu, gpu-1.9.0
  • gpu-1.9.0

Note: the new images won't have the latest tag by design.

New building strategy

We now use bake to orchestrate the build, which will be defined in the docker-bake.hcl file. See the README for examples about how to use it.

The builds leverage multiple stages and we'll distribute the base variants of the images which might be useful in the development process.

Notes for the reviewer

Currently adding automation, still WIP. The CI is good to go, not sure why the last step of the job is failing I suspect access management issues, worst case I'll wipe it off

Checklist

@masci masci added topic:build/distribution topic:DX Developer Experience labels Sep 5, 2022
@masci masci changed the title Reimplement Docker strategy refactoring: reimplement Docker strategy Sep 5, 2022
@masci masci marked this pull request as ready for review September 8, 2022 13:46
@masci masci requested review from a team as code owners September 8, 2022 13:46
@masci masci requested review from ZanSara and removed request for a team September 8, 2022 13:46
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good: I found only one issue and I added a few notes about some potential improvements. Nothing big anyway 👍

NOTE: I haven't review the CI part as you specified it's still WIP. Let me know when it's in a good state

docker/README.md Show resolved Hide resolved
docker/docker-bake.hcl Outdated Show resolved Hide resolved
docker/docker-bake.hcl Outdated Show resolved Hide resolved
docker/Dockerfile.base Show resolved Hide resolved
docker/Dockerfile.base Outdated Show resolved Hide resolved
docker/Dockerfile.base Show resolved Hide resolved
docker/docker-bake.hcl Show resolved Hide resolved
@masci masci requested a review from ZanSara September 8, 2022 16:58
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple more comments on the CI part, but basically ready to go 👍

.github/workflows/docker_release.yml Outdated Show resolved Hide resolved
.github/workflows/docker_release.yml Outdated Show resolved Hide resolved
.github/workflows/docker_release.yml Outdated Show resolved Hide resolved

- name: Release Haystack images
uses: docker/bake-action@v2
if: startsWith(github.ref, 'refs/tags/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this line, what is it doing? Are we not building the api-latest in some cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only build api-latest during a proper release and not when merging in main. But now I see a potential problem with bugfix releases, let me think about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok there was indeed a problem with the bugfix releases, now I compare the current version being built with the latest Haystack and only tag if the current one is greater

@masci masci requested a review from ZanSara September 12, 2022 08:35
Copy link
Contributor

@ZanSara ZanSara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! 👍

@masci masci merged commit 64b0c43 into main Sep 12, 2022
@masci masci deleted the massi/docker branch September 12, 2022 14:33
brandenchan pushed a commit that referenced this pull request Sep 21, 2022
* setup base images

* add cpu flavor

* use the same Dockerfile for cpu and gpu

* better naming, add docs

* add docker workflow

* add missing image input

* change cwd for bake

* also push api images

* try conditional tagging for releases

* revert testing code

* update docker readme

* document variable override

* use Python 3.10

* allow empty HAYSTACK_EXTRAS

* Apply suggestions from code review

Co-authored-by: Sara Zan <[email protected]>

* remove repo description step, can't make it work so far

* add docs to the last step as it's tricky

* manage tags for the newest images

* tests are passing, checking in the last bit

Co-authored-by: Sara Zan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants