CB-5 Add docker-compose.yml #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push to ACR | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to ACR | |
run: | | |
echo ${{ secrets.ACR_PASSWORD }} | docker login ${{ secrets.ACR_LOGIN_SERVER }} -u ${{ secrets.ACR_USERNAME }} --password-stdin | |
- name: Build and push Docker image for staging or production | |
run: | | |
# Create a tag that is common to both staging and production | |
if [[ "${{ github.ref }}" == "refs/heads/develop" ]]; then | |
IMAGE_TAG="staging-${{ github.sha }}" | |
else | |
IMAGE_TAG="prod-${{ github.sha }}" | |
fi | |
# Build and push the Docker image to ACR | |
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/chatbot-builder-engine:${IMAGE_TAG} . | |
docker push ${{ secrets.ACR_LOGIN_SERVER }}/chatbot-builder-engine:${IMAGE_TAG} | |
- name: Trigger staging deployment in k8s repo | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
https://api.github.com/repos/Chatbot-Builder-Project/chatbot-builder-k8s/dispatches \ | |
-d '{"event_type":"deploy_chatbot_staging", "client_payload": {"image_tag": "staging-${{ github.sha }}"}}' | |
- name: Trigger production deployment in k8s repo | |
if: github.ref == 'refs/heads/main' | |
run: | | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ | |
-H "Accept: application/vnd.github.everest-preview+json" \ | |
https://api.github.com/repos/Chatbot-Builder-Project/chatbot-builder-k8s/dispatches \ | |
-d '{"event_type":"deploy_chatbot_production", "client_payload": {"image_tag": "prod-${{ github.sha }}"}}' |