|
14 | 14 | # - SLACK_WEBHOOK_TOKEN: token to post to RasaHQ slack account (in 1password)
|
15 | 15 | # - PYPI_TOKEN: publishing token for amn41 account, needs to be maintainer of
|
16 | 16 | # 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 |
17 | 19 |
|
18 | 20 | env:
|
19 | 21 | # needed to fix issues with boto during testing:
|
@@ -155,13 +157,52 @@ jobs:
|
155 | 157 | COVERALLS_SERVICE_NAME: github
|
156 | 158 | run: poetry run coveralls
|
157 | 159 |
|
| 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 | +
|
158 | 199 | deploy:
|
159 | 200 | name: Deploy to PyPI
|
160 | 201 | runs-on: ubuntu-latest
|
161 | 202 |
|
162 | 203 | # deploy will only be run when there is a tag available
|
163 | 204 | 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 |
165 | 206 |
|
166 | 207 | steps:
|
167 | 208 | - name: Checkout git repository 🕝
|
@@ -195,7 +236,7 @@ jobs:
|
195 | 236 | env:
|
196 | 237 | GH_RELEASE_NOTES_TOKEN: ${{ secrets.GH_RELEASE_NOTES_TOKEN }}
|
197 | 238 | SLACK_WEBHOOK_TOKEN: ${{ secrets.SLACK_WEBHOOK_TOKEN }}
|
198 |
| - GITHUB_TAG: ${{ github.ref }} |
| 239 | + GITHUB_TAG: ${{ github.event.ref }} |
199 | 240 | GITHUB_REPO_SLUG: ${{ github.repository }}
|
200 | 241 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
201 | 242 | run: |
|
|
0 commit comments