-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat:调整构建脚本,删除nginx代码 * 使用rm -f防止删除失败 * feat; 无需执行清理逻辑 * feat: 修改nginx限流的问题 * feat: 重新编写readme * feat: 支持容器镜像的构建
- Loading branch information
1 parent
82fc302
commit e2b9bfe
Showing
9 changed files
with
194 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: DockerImage | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
name: Release Polaris Docker Image | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux] | ||
goarch: [amd64] | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Get version | ||
id: get_version | ||
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
config-inline: | | ||
insecure-entitlements = [ "network.host" ] | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.POLARIS_DOCKER_NAME }} | ||
password: ${{ secrets.POLARIS_DOCKER_PASSWORD }} | ||
|
||
- name: Build Server | ||
id: build-server | ||
env: | ||
DOCKER_TAG: ${{ steps.get_version.outputs.VERSION }} | ||
run: | | ||
cd build | ||
./build_docker.sh ${DOCKER_TAG} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM debian:stable-slim | ||
|
||
# install dependencies | ||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& apt-get install --no-install-recommends --no-install-suggests -y \ | ||
autoconf automake wget git libtool curl make gcc g++ unzip libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev | ||
|
||
COPY source /build/source | ||
COPY third_party /build/third_party | ||
COPY polaris.yaml /build/ | ||
|
||
# build polaris-cpp | ||
RUN set -ex \ | ||
&& cd /build/third_party \ | ||
&& git config --global http.sslverify false \ | ||
&& git clone -b release_v1.1.0 https://github.com/polarismesh/polaris-cpp polaris-cpp \ | ||
&& cd polaris-cpp \ | ||
&& make \ | ||
&& make package \ | ||
&& tar xf polaris_cpp_sdk.tar.gz \ | ||
&& mv polaris_cpp_sdk/* /build/third_party/polaris_client/ | ||
|
||
RUN set -ex \ | ||
&& mkdir -p /server \ | ||
&& cd /build/third_party \ | ||
&& ngx_file_name=nginx-1.23.1 \ | ||
&& curl http://nginx.org/download/"$ngx_file_name".tar.gz -o "$ngx_file_name".tar.gz \ | ||
&& tar xf "$ngx_file_name".tar.gz \ | ||
&& cp nginx/make "$ngx_file_name"/auto/ \ | ||
&& chmod +x "$ngx_file_name"/configure \ | ||
&& cd "$ngx_file_name" \ | ||
&& ./configure --prefix=/server --add-module=../../source/nginx_polaris_limit_module --add-module=../polaris_client --with-stream --with-cpp=g++ \ | ||
&& make | ||
|
||
WORKDIR /server | ||
|
||
CMD ["nginx", "-g", "daemon off;"] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
if [ $# != 1 ]; then | ||
echo "e.g.: bash $0 v1.0" | ||
exit 1 | ||
fi | ||
|
||
docker_tag=$1 | ||
|
||
docker_repository="polarismesh" | ||
|
||
echo "docker repository : ${docker_repository}/nginx, tag : ${docker_tag}" | ||
|
||
arch_list=( "amd64" ) | ||
platforms="" | ||
|
||
for arch in ${arch_list[@]}; do | ||
platforms+="linux/${arch}," | ||
done | ||
|
||
platforms=${platforms::-1} | ||
extra_tags="" | ||
|
||
pre_release=`echo ${docker_tag}|egrep "(alpha|beta|rc|[T|t]est)"|wc -l` | ||
if [ ${pre_release} == 0 ]; then | ||
extra_tags="-t ${docker_repository}/nginx:latest" | ||
fi | ||
|
||
cd .. | ||
docker buildx build --network=host -t ${docker_repository}/nginx:${docker_tag} ${extra_tags} --platform ${platforms} --push ./ |
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
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
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
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