chore: remove unnecessary sudo usages when build docker image (#602)
Signed-off-by: Nic <qianyong@api7.ai>
diff --git a/.github/workflows/apisix_push_docker_hub.yaml b/.github/workflows/apisix_push_docker_hub.yaml
index 6f566ba..374dc7f 100644
--- a/.github/workflows/apisix_push_docker_hub.yaml
+++ b/.github/workflows/apisix_push_docker_hub.yaml
@@ -1,7 +1,12 @@
-name: Push apisix to Docker image
+name: Docker image
on:
+ pull_request:
+ branches:
+ - master
push:
- branches: ['release/apisix-**']
+ branches:
+ - master
+ - release/apisix-**
jobs:
build:
@@ -49,23 +54,25 @@
exit 125
fi
- - name: Login to Docker Hub
- uses: docker/login-action@v1
- with:
- username: ${{ secrets.DOCKERHUB_USER }}
- password: ${{ secrets.DOCKERHUB_TOKEN }}
-
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
+ - name: Login to Docker Hub
+ if: ${{ startsWith(github.ref_name, 'release/apisix') }}
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKERHUB_USER }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
- name: push apisix:latest image to docker hub
- if: matrix.platform == 'ubuntu'
+ if: ${{ startsWith(github.ref_name, 'release/apisix') && (matrix.platform == 'ubuntu') }}
run: |
make push-multiarch-on-latest
- name: Push apisix:${{ matrix.os }} image to Docker Hub
+ if: ${{ startsWith(github.ref_name, 'release/apisix') }}
run: |
make push-multiarch-on-${{ matrix.platform }}
diff --git a/redhat/install-brotli.sh b/redhat/install-brotli.sh
index 24cc30a..565fe6c 100644
--- a/redhat/install-brotli.sh
+++ b/redhat/install-brotli.sh
@@ -1,24 +1,23 @@
install_brotli () {
- yum install -y sudo cmake3 wget unzip gcc
+ yum install -y cmake3 wget unzip gcc
export PATH=$PATH:/usr/local/bin
local BORTLI_VERSION="1.1.0"
wget -q https://github.com/google/brotli/archive/refs/tags/v${BORTLI_VERSION}.zip || exit -1
unzip v${BORTLI_VERSION}.zip && cd ./brotli-${BORTLI_VERSION} && mkdir build && cd build || exit -1
local CMAKE=$(command -v cmake3 > /dev/null 2>&1 && echo cmake3 || echo cmake) || exit -1
${CMAKE} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/brotli .. || exit -1
- sudo ${CMAKE} --build . --config Release --target install || exit -1
+ ${CMAKE} --build . --config Release --target install || exit -1
if [ -d "/usr/local/brotli/lib64" ]; then
- echo /usr/local/brotli/lib64 | sudo tee /etc/ld.so.conf.d/brotli.conf
+ echo /usr/local/brotli/lib64 | tee /etc/ld.so.conf.d/brotli.conf
else
- echo /usr/local/brotli/lib | sudo tee /etc/ld.so.conf.d/brotli.conf
+ echo /usr/local/brotli/lib | tee /etc/ld.so.conf.d/brotli.conf
fi
- sudo ldconfig || exit -1
+ ldconfig || exit -1
ln -sf /usr/local/brotli/bin/brotli /usr/bin/brotli
cd ../..
rm -rf brotli-${BORTLI_VERSION}
rm -rf /v${BORTLI_VERSION}.zip
yum remove -y cmake3 wget unzip gcc
- rm -rf /usr/bin/sudo
yum clean all -y
}
-install_brotli
\ No newline at end of file
+install_brotli