Skip to content

fix: dockerfile build failed #3425

fix: dockerfile build failed

fix: dockerfile build failed #3425

Workflow file for this run

name: Auto Build RPM
on:
push:
branches: [master, 'release/**']
paths-ignore:
- 'docs/**'
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
jobs:
auto_build_rpm:
name: Auto Build RPM package
runs-on: ubuntu-latest
services:
etcd:
image: bitnami/etcd:3.5.2
ports:
- 2379:2379
- 2380:2380
env:
ALLOW_NONE_AUTHENTICATION: yes
ETCD_ADVERTISE_CLIENT_URLS: http://0.0.0.0:2379
steps:
- name: Check out code
uses: actions/checkout@v3
- 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: Extract branch name
id: branch_env
shell: bash
run: |
echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})"
- name: Build rpm package
run: |
export VERSION=${{ steps.branch_env.outputs.version }}
sudo gem install --no-document fpm
git clone https://github.com/api7/apisix-build-tools.git
# move codes under build tool
mkdir ./apisix-build-tools/apisix-dashboard
for dir in `ls|grep -v "^apisix-build-tools$"`;do cp -r $dir ./apisix-build-tools/apisix-dashboard/;done
cd apisix-build-tools
export checkout=master
if [ "$VERSION" != "merge" && "$VERSION" != "master" ];then
export checkout=release/${VERSION}
fi
make package type=rpm app=dashboard version=${VERSION} checkout=${checkout} image_base=centos image_tag=7 local_code_path=./apisix-dashboard buildx=True
- name: Run centos7 docker and mapping apisix into container
run: |
docker run -itd -v $PWD:/apisix-dashboard --name centos7Instance --net="host" docker.io/centos:7 /bin/bash
- name: Install rpm package
run: |
export VERSION=${{ steps.branch_env.outputs.version }}
docker exec centos7Instance bash -c "cd apisix-dashboard && yum install -y ./apisix-build-tools/output/apisix-dashboard-${VERSION}-0.el7.x86_64.rpm"
docker logs centos7Instance
# Dependencies are attached with rpm, so revert `make deps`
docker exec centos7Instance bash -c "cd /usr/local/apisix/dashboard/ && nohup ./manager-api &"
- name: Run test cases
run: |
api/test/shell/manager_smoking.sh -s true
- name: Publish Artifact
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
uses: actions/upload-artifact@v3
with:
name: "rpm"
path: "./apisix-build-tools/output/apisix-dashboard-${{ steps.branch_env.outputs.version }}-0.el7.x86_64.rpm"