Skip to content

Commit

Permalink
Multi-platform docker image (#12533)
Browse files Browse the repository at this point in the history
* Bump version of tensorflow (#12515)

Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises

* Remove dependency on tensorflow-addons (#12514)

Remove dependency on tensorflow-addons

Copy tests for crf and metrics

* Multi-platform image with GitHub Actions (#12528)

* Build both platforms on the same machine

* Bump version of tensorflow (#12515)

Bump version of tensorflow

* Fix spacy version, bump the pydantic version because of explosion/spaCy#12659
* Fix ruff version because of new warnings
* Fix spacy<3.5 because of tests/nlu/extractors/test_spacy_entity_extractors.py
* Downgrade ruamel because of failing test tests/shared/nlu/training_data/formats/test_rasa_yaml.py::test_wrong_format_raises

* Remove dependency on tensorflow-addons (#12514)

Remove dependency on tensorflow-addons

Copy tests for crf and metrics

* Multi-platform image with GitHub Actions (#12528)

* Build both platforms on the same machine

* Update poetry

* Add changelog

---------

Co-authored-by: Sanchari <s.ghosh@rasa.com>
  • Loading branch information
d61h6k4 and sanchariGr authored Jun 23, 2023
1 parent 294cae8 commit 6212074
Show file tree
Hide file tree
Showing 10 changed files with 2,122 additions and 1,127 deletions.
42 changes: 16 additions & 26 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,7 @@ jobs:
image_tag: ${{ steps.set_output.outputs.image_tag }}
# Return 'true' if tag version is equal or higher than the latest tagged Rasa version
is_newest_version: ${{ steps.rasa_get_version.outputs.is_newest_version }}
strategy:
matrix:
arch: [linux/amd64, linux/arm64]

steps:
# Due to an issue with checking out a wrong commit, we make sure
# to checkout HEAD commit for a pull request.
Expand All @@ -841,18 +839,15 @@ jobs:
if: github.event_name != 'pull_request'

- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
uses: docker/setup-qemu-action@v2

- name: Read Poetry Version 🔢
run: |
echo "POETRY_VERSION=$(scripts/poetry-version.sh)" >> $GITHUB_ENV
shell: bash

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c
with:
version: v0.5.1
driver: docker
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub Registry 🔢
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ env.DOCKERHUB_USERNAME }} --password-stdin || true
Expand Down Expand Up @@ -912,51 +907,51 @@ jobs:
if: steps.check_image.outputs.base_exists == 'false' || env.IS_TAG_BUILD == 'true'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base
- name: Push Docker base image if it's not building from a fork ⬆
if: (steps.check_image.outputs.base_exists == 'false' || env.IS_TAG_BUILD == 'true') && github.event.pull_request.head.repo.owner.login == 'RasaHQ'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base --push
- name: Build Docker mitie base image 🛠
if: steps.check_image.outputs.base_mitie_exists == 'false' || steps.check_image.outputs.base_exists == 'false'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_mitie_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-mitie
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-mitie
- name: Push Docker mitie base image if it's not building from a fork ⬆
if: (steps.check_image.outputs.base_mitie_exists == 'false' || steps.check_image.outputs.base_exists == 'false') && github.event.pull_request.head.repo.owner.login == 'RasaHQ'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_mitie_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-mitie --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-mitie --push
- name: Build Docker poetry base image 🛠
if: steps.check_image.outputs.base_poetry_exists == 'false' || steps.check_image.outputs.base_exists == 'false'
run: |
export IMAGE_TAG=${{ env.POETRY_VERSION }}
export BASE_IMAGE_HASH=${{ steps.check_image.outputs.base_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-poetry
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-poetry
- name: Push Docker poetry base image if it's not building from a fork ⬆
if: (steps.check_image.outputs.base_poetry_exists == 'false' || steps.check_image.outputs.base_exists == 'false') && github.event.pull_request.head.repo.owner.login == 'RasaHQ'
run: |
export IMAGE_TAG=${{ env.POETRY_VERSION }}
export BASE_IMAGE_HASH=${{ steps.check_image.outputs.base_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-poetry --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-poetry --push
- name: Build Docker builder base image 🛠
if: steps.check_image.outputs.base_builder_exists == 'false' || steps.check_image.outputs.base_exists == 'false'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_builder_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-builder
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-builder
- name: Push Docker builder base image if it's not building from a fork ⬆
if: (steps.check_image.outputs.base_builder_exists == 'false' || steps.check_image.outputs.base_exists == 'false') && github.event.pull_request.head.repo.owner.login == 'RasaHQ'
run: |
export IMAGE_TAG=${{ steps.check_image.outputs.base_builder_image_hash }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl base-builder --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl base-builder --push
# Set environment variables for a pull request
#
Expand Down Expand Up @@ -1013,7 +1008,6 @@ jobs:
strategy:
matrix:
image: [default, full, mitie-en, spacy-de, spacy-it, spacy-en]
arch: [linux/amd64, linux/arm64]

steps:
# Due to an issue with checking out a wrong commit, we make sure
Expand All @@ -1030,7 +1024,7 @@ jobs:
if: github.event_name != 'pull_request'

- name: Set up QEMU
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
uses: docker/setup-qemu-action@v2

- name: Free disk space
if: needs.changes.outputs.docker == 'true'
Expand All @@ -1049,11 +1043,7 @@ jobs:
shell: bash

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c
id: buildx
with:
version: v0.5.1
driver: docker
uses: docker/setup-buildx-action@v2

- name: Echo Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
Expand All @@ -1073,19 +1063,19 @@ jobs:
- name: Build Docker image
if: needs.changes.outputs.docker == 'true'
run: |
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl ${{ matrix.image }}
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl ${{ matrix.image }}
- name: Push image with main tag 📦
if: needs.changes.outputs.docker == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'RasaHQ/rasa'
run: |
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl ${{ matrix.image }} --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl ${{ matrix.image }} --push
- name: Push image with ${{github.ref}} tag 📦
if: needs.changes.outputs.docker == 'true' && github.event_name == 'push' && env.IS_TAG_BUILD == 'true' && github.repository == 'RasaHQ/rasa'
run: |
IS_NEWEST_VERSION=${{ needs.build_docker_base_images_and_set_env.outputs.is_newest_version }}
docker buildx bake --set *.platform=${{ matrix.arch }} -f docker/docker-bake.hcl ${{ matrix.image }} --push
docker buildx bake --set *.platform=linux/amd64,linux/arm64 -f docker/docker-bake.hcl ${{ matrix.image }} --push
# Tag the image as latest
if [[ "${IS_NEWEST_VERSION}" == "true" ]]; then
Expand Down
1 change: 1 addition & 0 deletions changelog/12533.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add building multi-platform Docker image (amd64/arm64)
Loading

0 comments on commit 6212074

Please sign in to comment.