blob: 21415f183059362380da7077ffe8878962db61c0 [file] [log] [blame]
name: Test and Deploy with Docker
on:
push:
branches:
- master
paths-ignore:
- 'docs/**'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Azure/docker-login@v1
if: ${{ github.event_name == 'push' }}
with:
login-server: apisixacr.azurecr.cn
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build Docker Image
run: |
docker build -t dashboard:ci . --build-arg APISIX_DASHBOARD_VERSION=master
- name: Modify Config
run: |
sed -i 's/127.0.0.1:2379/172.16.238.10:2379/' api/conf/conf.yaml
sed -i 's@127.0.0.1@0.0.0.0/0@' ./api/conf/conf.yaml
# At present, the docker CI is still running the code of the master branch
# So we need to configure `listen.host` so that it can be accessed outside docker
sed -i '/port: 9000/i\ host: 0.0.0.0' ./api/conf/conf.yaml
- name: Run Docker Compose
working-directory: ./api/test/docker-deploy
run: |
docker-compose up -d
sleep 5
docker logs docker-deploy_managerapi_1
- name: Run Test
run: api/test/shell/manager_smoking.sh -s false
- name: Deploy
if: ${{ github.event_name == 'push' }}
run: |
docker tag dashboard:ci apisixacr.azurecr.cn/dashboard:${{ github.sha }}
docker push apisixacr.azurecr.cn/dashboard:${{ github.sha }}