Skip to content

Commit 30285a6

Browse files
authored
Merge pull request RasaHQ#5330 from RasaHQ/build-docker
Build docker containers as part of our continuous integration workflow
2 parents 6264e17 + 4a05f22 commit 30285a6

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

.github/workflows/continous-integration.yml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
# - SLACK_WEBHOOK_TOKEN: token to post to RasaHQ slack account (in 1password)
1515
# - PYPI_TOKEN: publishing token for amn41 account, needs to be maintainer of
1616
# RasaHQ/rasa on pypi (account credentials in 1password)
17+
# - DOCKERHUB_PASSWORD: password for an account with write access to the rasa
18+
# repo on hub.docker.com. used to pull and upload containers
1719

1820
env:
1921
# needed to fix issues with boto during testing:
@@ -155,13 +157,52 @@ jobs:
155157
COVERALLS_SERVICE_NAME: github
156158
run: poetry run coveralls
157159

160+
docker:
161+
name: Build Docker
162+
runs-on: ubuntu-latest
163+
164+
strategy:
165+
matrix:
166+
image:
167+
- {"file": "Dockerfile", "tag_ext": ""}
168+
- {"file": "docker/Dockerfile_full", "tag_ext": "-full"}
169+
- {"file": "docker/Dockerfile_pretrained_embeddings_mitie_en", "tag_ext": "-mitie-en"}
170+
- {"file": "docker/Dockerfile_pretrained_embeddings_spacy_de", "tag_ext": "-spacy-de"}
171+
- {"file": "docker/Dockerfile_pretrained_embeddings_spacy_en", "tag_ext": "-spacy-en"}
172+
173+
env:
174+
DOCKERHUB_USERNAME: tmbo
175+
176+
steps:
177+
- name: Checkout git repository 🕝
178+
uses: actions/checkout@v2
179+
180+
- name: Login to DockerHub Registry 🔢
181+
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ env.DOCKERHUB_USERNAME }} --password-stdin
182+
183+
- name: Pull latest${{ matrix.image.tag_ext }} Docker image for caching
184+
run: docker pull rasa/rasa:latest${{ matrix.image.tag_ext }} || true
185+
186+
- name: Build latest${{ matrix.image.tag_ext }} Docker image
187+
run: docker build . --file ${{ matrix.image.file }} --tag rasa/rasa:latest${{ matrix.image.tag_ext }} --cache-from rasa/rasa:latest${{ matrix.image.tag_ext }}
188+
189+
- name: Push image with latest tag 📦
190+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
191+
run: docker push rasa/rasa:latest${{ matrix.image.tag_ext }}
192+
193+
- name: Push image with ${{github.event.ref}} tag 📦
194+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
195+
run: |
196+
docker tag rasa/rasa:latest${{ matrix.image.tag_ext }} rasa/rasa:${{github.event.ref}}${{ matrix.image.tag_ext }}
197+
docker push rasa/rasa:${{github.event.ref}}${{ matrix.image.tag_ext }}
198+
158199
deploy:
159200
name: Deploy to PyPI
160201
runs-on: ubuntu-latest
161202

162203
# deploy will only be run when there is a tag available
163204
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
164-
needs: [quality, test, api] # only run after all other stages succeeded
205+
needs: [quality, test, api, docker] # only run after all other stages succeeded
165206

166207
steps:
167208
- name: Checkout git repository 🕝
@@ -195,7 +236,7 @@ jobs:
195236
env:
196237
GH_RELEASE_NOTES_TOKEN: ${{ secrets.GH_RELEASE_NOTES_TOKEN }}
197238
SLACK_WEBHOOK_TOKEN: ${{ secrets.SLACK_WEBHOOK_TOKEN }}
198-
GITHUB_TAG: ${{ github.ref }}
239+
GITHUB_TAG: ${{ github.event.ref }}
199240
GITHUB_REPO_SLUG: ${{ github.repository }}
200241
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201242
run: |

changelog/5330.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Build our docker containers as part of our continuous integration workflow.

0 commit comments

Comments
 (0)