Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rename apisix-openresty to apisix-base #103

Merged
merged 2 commits into from
Sep 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: package apisix-openresty deb for ubuntu 20.04(Focal Fossa)
name: package apisix-base deb for ubuntu 20.04(Focal Fossa)

on:
push:
Expand All @@ -14,19 +14,19 @@ jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_APISIX_OR_VERSION: 1.19.3.2.0
BUILD_APISIX_BASE_VERSION: 1.19.3.2.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential

- name: build apisix-openresty deb
- name: build apisix-base deb
run: |
make package type=deb app=apisix-openresty version=${BUILD_APISIX_OR_VERSION} image_base=ubuntu image_tag=20.04
make package type=deb app=apisix-base version=${BUILD_APISIX_BASE_VERSION} image_base=ubuntu image_tag=20.04

- name: run ubuntu 20.04 docker and mapping apisix-openresty deb into container
- name: run ubuntu 20.04 docker and mapping apisix-base deb into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name ubuntu20.04Instance --net="host" docker.io/ubuntu:20.04 /bin/bash

Expand All @@ -42,17 +42,17 @@ jobs:

- name: install deb in container
run: |
docker exec ubuntu20.04Instance bash -c "dpkg -i /output/apisix-openresty_${BUILD_APISIX_OR_VERSION}-0~ubuntu20.04_amd64.deb"
docker exec ubuntu20.04Instance bash -c "dpkg -i /output/apisix-base_${BUILD_APISIX_BASE_VERSION}-0~ubuntu20.04_amd64.deb"

- name: check and ensure openresty is installed
- name: check and ensure apisix-base is installed
run: |
export APISIX_OPENRESTY_VER=$(docker exec ubuntu20.04Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_OPENRESTY_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_OPENRESTY_VER" != "${BUILD_APISIX_OR_VERSION}" ]; then exit 1; fi
export APISIX_BASE_VER=$(docker exec ubuntu20.04Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_BASE_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_BASE_VER" != "${BUILD_APISIX_BASE_VERSION}" ]; then exit 1; fi

- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: apisix-openresty_${{ env.BUILD_APISIX_OR_VERSION }}-0~ubuntu20.04_amd64.deb
path: output/apisix-openresty_${{ env.BUILD_APISIX_OR_VERSION }}-0~ubuntu20.04_amd64.deb
name: apisix-base_${{ env.BUILD_APISIX_BASE_VERSION }}-0~ubuntu20.04_amd64.deb
path: output/apisix-base_${{ env.BUILD_APISIX_BASE_VERSION }}-0~ubuntu20.04_amd64.deb
retention-days: 5
if-no-files-found: error
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: package apisix-openresty rpm for el7
name: package apisix-base rpm for el7

on:
push:
Expand All @@ -14,19 +14,19 @@ jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_APISIX_OR_VERSION: 1.19.3.2.0
BUILD_APISIX_BASE_VERSION: 1.19.3.2.0
steps:
- uses: actions/checkout@v2

- name: install dependencies
run: |
sudo apt-get install -y make ruby ruby-dev rubygems build-essential

- name: build apisix-openresty rpm
- name: build apisix-base rpm
run: |
make package type=rpm app=apisix-openresty version=${BUILD_APISIX_OR_VERSION} image_base=centos image_tag=7
make package type=rpm app=apisix-base version=${BUILD_APISIX_BASE_VERSION} image_base=centos image_tag=7

- name: run centos7 docker and mapping apisix-openresty rpm into container
- name: run centos7 docker and mapping apisix-base rpm into container
run: |
docker run -itd -v /home/runner/work/apisix-build-tools/apisix-build-tools/output:/output --name centos7Instance --net="host" docker.io/centos:7 /bin/bash

Expand All @@ -37,17 +37,17 @@ jobs:

- name: install rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-openresty-${BUILD_APISIX_OR_VERSION}-0.el7.x86_64.rpm"
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-base-${BUILD_APISIX_BASE_VERSION}-0.el7.x86_64.rpm"

- name: check and ensure openresty is installed
- name: check and ensure apisix-base is installed
run: |
export APISIX_OPENRESTY_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_OPENRESTY_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_OPENRESTY_VER" != "${BUILD_APISIX_OR_VERSION}" ]; then exit 1; fi
export APISIX_BASE_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_BASE_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_BASE_VER" != "${BUILD_APISIX_BASE_VERSION}" ]; then exit 1; fi

- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: apisix-openresty-${{ env.BUILD_APISIX_OR_VERSION }}-0.el7.x86_64.rpm
path: output/apisix-openresty-${{ env.BUILD_APISIX_OR_VERSION }}-0.el7.x86_64.rpm
name: apisix-base-${{ env.BUILD_APISIX_BASE_VERSION }}-0.el7.x86_64.rpm
path: output/apisix-base-${{ env.BUILD_APISIX_BASE_VERSION }}-0.el7.x86_64.rpm
retention-days: 5
if-no-files-found: error
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: package apisix rpm depends on apisix-openresty for el7
name: package apisix rpm depends on apisix-base for el7

on:
push:
Expand All @@ -14,7 +14,7 @@ jobs:
build:
runs-on: ubuntu-latest
env:
BUILD_APISIX_OR_VERSION: 1.19.3.2.0
BUILD_APISIX_BASE_VERSION: 1.19.3.2.0
services:
etcd:
image: bitnami/etcd:3.4.0
Expand All @@ -36,12 +36,12 @@ jobs:

- name: packaging APISIX
run: |
make package type=rpm app=apisix version=2.7 checkout=release/2.7 image_base=centos image_tag=7 openresty=apisix-openresty
make package type=rpm app=apisix version=master checkout=master image_base=centos image_tag=7 openresty=apisix-openresty
make package type=rpm app=apisix version=2.7 checkout=release/2.7 image_base=centos image_tag=7 openresty=apisix-base
make package type=rpm app=apisix version=master checkout=master image_base=centos image_tag=7 openresty=apisix-base

- name: packaging apisix-openresty
- name: packaging apisix-base
run: |
make package type=rpm app=apisix-openresty version=${BUILD_APISIX_OR_VERSION} image_base=centos image_tag=7 openresty=apisix-openresty
make package type=rpm app=apisix-base version=${BUILD_APISIX_BASE_VERSION} image_base=centos image_tag=7

- name: run centos7 docker and mapping rpm into container
run: |
Expand All @@ -52,16 +52,16 @@ jobs:
docker exec centos7Instance bash -c "yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo"
docker exec centos7Instance bash -c "yum -y install openresty-openssl111 openresty-pcre openresty-zlib"

- name: install apisix-openresty rpm in container
- name: install apisix-base rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-openresty-${BUILD_APISIX_OR_VERSION}-0.el7.x86_64.rpm"
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-base-${BUILD_APISIX_BASE_VERSION}-0.el7.x86_64.rpm"

- name: check and ensure apisix-openresty is installed correctly
- name: check and ensure apisix-base is installed correctly
run: |
export APISIX_OPENRESTY_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_OPENRESTY_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_OPENRESTY_VER" != "${BUILD_APISIX_OR_VERSION}" ]; then exit 1; fi
export APISIX_BASE_VER=$(docker exec centos7Instance bash -c "openresty -V" 2>&1 | awk '/-O2 -DAPISIX_BASE_VER=/{print $5}' | awk -v FS="=" '{print $2}')
if [ "$APISIX_BASE_VER" != "${BUILD_APISIX_BASE_VERSION}" ]; then exit 1; fi

- name: install APISIX which depens on apisix-openresty by rpm in container
- name: install APISIX which depens on apisix-base by rpm in container
run: |
docker exec centos7Instance bash -c "yum -y localinstall /output/apisix-master-0.el7.x86_64.rpm"
docker exec centos7Instance bash -c "apisix start"
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Publish Artifact
uses: actions/upload-artifact@v2.2.4
with:
name: apisix-master-0.el7.x86_64.rpm that depends on apisix-openresty
name: apisix-master-0.el7.x86_64.rpm that depends on apisix-base
path: output/apisix-master-0.el7.x86_64.rpm
retention-days: 5
if-no-files-found: error
44 changes: 22 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,24 +146,24 @@ package-dashboard-rpm:
package-dashboard-deb:
$(call package,apisix-dashboard,deb)

### build apisix-openresty:
.PHONY: build-apisix-openresty-rpm
build-apisix-openresty-rpm:
$(call build,apisix-openresty,apisix-openresty,rpm,$(local_code_path))
### build apisix-base:
.PHONY: build-apisix-base-rpm
build-apisix-base-rpm:
$(call build,apisix-base,apisix-base,rpm,$(local_code_path))

.PHONY: build-apisix-openresty-deb
build-apisix-openresty-deb:
$(call build,apisix-openresty,apisix-openresty,deb,$(local_code_path))
.PHONY: build-apisix-base-deb
build-apisix-base-deb:
$(call build,apisix-base,apisix-base,deb,$(local_code_path))

### build rpm for apisix-openresty:
.PHONY: package-apisix-openresty-rpm
package-apisix-openresty-rpm:
$(call package,apisix-openresty,rpm)
### build rpm for apisix-base:
.PHONY: package-apisix-base-rpm
package-apisix-base-rpm:
$(call package,apisix-base,rpm)

### build deb for apisix-openresty:
.PHONY: package-apisix-openresty-deb
package-apisix-openresty-deb:
$(call package,apisix-openresty,deb)
### build deb for apisix-base:
.PHONY: package-apisix-base-deb
package-apisix-base-deb:
$(call package,apisix-base,deb)

### build fpm for packaging:
.PHONY: build-fpm
Expand All @@ -179,7 +179,7 @@ build-fpm:
-t api7/fpm - < ./dockerfiles/Dockerfile.fpm
endif

ifeq ($(filter $(app),apisix dashboard apisix-openresty),)
ifeq ($(filter $(app),apisix dashboard apisix-base),)
$(info the app's value have to be apisix or dashboard!)

else ifeq ($(filter $(type),rpm deb),)
Expand All @@ -188,15 +188,15 @@ $(info the type's value have to be rpm or deb!)
else ifeq ($(version), 0)
$(info you have to input a version value!)

else ifeq ($(app)_$(type),apisix-openresty_rpm)
else ifeq ($(app)_$(type),apisix-base_rpm)
package: build-fpm
package: build-apisix-openresty-rpm
package: package-apisix-openresty-rpm
package: build-apisix-base-rpm
package: package-apisix-base-rpm

else ifeq ($(app)_$(type),apisix-openresty_deb)
else ifeq ($(app)_$(type),apisix-base_deb)
package: build-fpm
package: build-apisix-openresty-deb
package: package-apisix-openresty-deb
package: build-apisix-base-deb
package: package-apisix-base-deb

else ifeq ($(checkout), 0)
$(info you have to input a checkout value!)
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
|Parameter |Required |Description |Example|
|---------|---------|----|-----------|
|type |True |it can be `deb` or `rpm` |type=rpm|
|app |True |it can be `apisix`, `dashboard` or `apisix-openresty`|app=apisix|
|app |True |it can be `apisix`, `dashboard` or `apisix-base`|app=apisix|
|checkout |True |the code branch or tag of the app which you want to package|checkout=2.1 or checkout=v2.1|
|version |True |the version of the package|version=10.10|
|local_code_path |False | the path of local code diretory of apisix or dashboard, which depends on the app parameter|local_code_path=/home/vagrant/apisix|
|openresty |False |the openresty type that apisix depends on, its value can be `openresty` or `apisix-openresty`, the default is `openresty`|openresty=apisix-openresty|
|openresty |False |the openresty type that apisix depends on, its value can be `openresty` or `apisix-base`, the default is `openresty`|openresty=apisix-base|
|artifact |False |the final name of the generated artifact, if not specified, this will be the same as `app`|artifact=apisixty|
|image_base|False |the environment for packaging, if type is `rpm` the default image_base is `centos`, if type is `deb` the default image_base is `ubuntu`|image_base=centos|
|image_tag|False |the environment for packaging, it's value can be `16.04\|18.04\|20.04\|6\|7\|8`, if type is `rpm` the default image_tag is `7`, if type is `deb` the default image_tag is `20.04`|image_tag=7|
Expand Down Expand Up @@ -63,16 +63,16 @@ apisix-dashboard_2.2-0~ubuntu20.04_amd64.deb

Packaging a Centos 7 package of APISIX's OpenResty distribution
```sh
make package type=rpm app=apisix-openresty version=1.0.0 image_base=centos image_tag=7
make package type=rpm app=apisix-base version=1.0.0 image_base=centos image_tag=7
ls output/
apisix-openresty-1.0.0-0.el7.x86_64.rpm
apisix-base-1.0.0-0.el7.x86_64.rpm
```

Packaging an Ubuntu 20.04 package of Apache APISIX's OpenResty distribution
```sh
make package type=deb app=apisix-openresty version=1.0.0
make package type=deb app=apisix-base version=1.0.0
ls output/
apisix-openresty_1.0.0-0~ubuntu20.04_amd64.deb
apisix-base_1.0.0-0~ubuntu20.04_amd64.deb
```

## Details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export luajit_xcflags="-DLUAJIT_ASSERT -DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52C
export OR_PREFIX=/usr/local/openresty-debug
export debug_args=--with-debug

./build-apisix-openresty.sh
./build-apisix-base.sh
2 changes: 1 addition & 1 deletion build-apisix-openresty.sh → build-apisix-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ no_pool_patch=${no_pool_patch:-}

cd openresty-${or_ver} || exit 1
./configure --prefix="$OR_PREFIX" \
--with-cc-opt="-DAPISIX_OPENRESTY_VER=$version $cc_opt" \
--with-cc-opt="-DAPISIX_BASE_VER=$version $cc_opt" \
--with-ld-opt="$ld_opt" \
--add-module=../mod_dubbo \
--add-module=../ngx_multi_upstream_module \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG IMAGE_TAG="20.04"
FROM ${IMAGE_BASE}:${IMAGE_TAG}

COPY ./utils/build-common.sh /tmp/build-common.sh
COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh
COPY build-apisix-base.sh /tmp/build-apisix-base.sh
COPY ./utils/determine-dist.sh /tmp/determine-dist.sh

WORKDIR /tmp
Expand All @@ -17,6 +17,6 @@ ENV IMAGE_BASE=${IMAGE_BASE}
ENV IMAGE_TAG=${IMAGE_TAG}
ENV version=${VERSION}

RUN ./build-common.sh build_apisix_openresty_deb \
RUN ./build-common.sh build_apisix_base_deb \
# determine dist and write it into /tmp/dist file
&& /tmp/determine-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG IMAGE_TAG="7"
FROM ${IMAGE_BASE}:${IMAGE_TAG}

COPY ./utils/build-common.sh /tmp/build-common.sh
COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh
COPY build-apisix-base.sh /tmp/build-apisix-base.sh
COPY ./utils/determine-dist.sh /tmp/determine-dist.sh

WORKDIR /tmp
Expand All @@ -17,6 +17,6 @@ ENV IMAGE_BASE=${IMAGE_BASE}
ENV IMAGE_TAG=${IMAGE_TAG}
ENV version=${VERSION}

RUN ./build-common.sh build_apisix_openresty_rpm \
RUN ./build-common.sh build_apisix_base_rpm \
# determine dist and write it into /tmp/dist file
&& /tmp/determine-dist.sh
23 changes: 23 additions & 0 deletions dockerfiles/Dockerfile.package.apisix-base
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG VERSION
ARG PACKAGE_TYPE

FROM apache/apisix-base-${PACKAGE_TYPE}:${VERSION} AS APISIX-BASE
FROM api7/fpm

ARG ITERATION
ARG PACKAGE_VERSION
ARG PACKAGE_TYPE
ARG ARTIFACT

ENV ITERATION=${ITERATION}
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
ENV PACKAGE_TYPE=${PACKAGE_TYPE}
ENV ARTIFACT=${ARTIFACT}

COPY --from=APISIX-BASE /usr/local/openresty /tmp/build/output/openresty
COPY --from=APISIX-BASE /tmp/dist /tmp/dist
COPY package-apisix-base.sh /package-apisix-base.sh
COPY post-install-apisix-base.sh /post-install-apisix-base.sh
COPY usr /usr

RUN /package-apisix-base.sh
23 changes: 0 additions & 23 deletions dockerfiles/Dockerfile.package.apisix-openresty

This file was deleted.

Loading