| name: Test and Deploy with Docker |
| |
| on: |
| push: |
| branches: |
| - master |
| paths-ignore: |
| - 'docs/**' |
| pull_request: |
| branches: |
| - master |
| paths-ignore: |
| - 'docs/**' |
| |
| concurrency: |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_number || github.ref }} |
| cancel-in-progress: true |
| |
| jobs: |
| build: |
| runs-on: ubuntu-latest |
| |
| steps: |
| - uses: actions/checkout@v3 |
| with: |
| submodules: recursive |
| |
| - uses: docker/setup-buildx-action@v2 |
| |
| - uses: actions/cache@v3 |
| with: |
| path: /tmp/.buildx-cache |
| key: ${{ runner.os }}-buildx-apisixdashboard-${{ github.sha }} |
| restore-keys: | |
| ${{ runner.os }}-buildx-apisixdashboard- |
| ${{ runner.os }}-buildx- |
| |
| - name: Build Docker Image |
| uses: docker/build-push-action@v4 |
| with: |
| load: true |
| tags: dashboard:ci |
| context: . |
| build-args: | |
| APISIX_DASHBOARD_VERSION=master |
| cache-from: | |
| type=local,src=/tmp/.buildx-cache |
| cache-to: | |
| type=local,dest=/tmp/.buildx-cache |
| |
| - 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: build docker images |
| working-directory: ./api/test/docker-deploy |
| continue-on-error: true |
| run: | |
| docker buildx bake --load \ |
| -f docker-compose.yaml \ |
| --set *.cache-from=type=local,src=/tmp/.buildx-cache \ |
| --set *.cache-to=type=local,dest=/tmp/.buildx-cache |
| |
| - 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 |