Skip to content

Commit dad276e

Browse files
authored
feat: pass package version to the binary (#47)
1 parent 9b9dbf6 commit dad276e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ package-dashboard-rpm:
8080
.PHONY: build-apisix-openresty-rpm
8181
build-apisix-openresty-rpm:
8282
mkdir -p ${PWD}/build/rpm
83-
docker build -t apache/apisix-openresty:$(version) -f ./dockerfiles/Dockerfile.apisix-openresty.rpm .
83+
docker build -t apache/apisix-openresty:$(version) --build-arg version=$(version) \
84+
-f ./dockerfiles/Dockerfile.apisix-openresty.rpm .
8485
docker run -d --name dockerInstance --net="host" apache/apisix-openresty:$(version)
8586
docker cp dockerInstance:/usr/local/openresty/ ${PWD}/build/rpm
8687
docker system prune -a -f

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ apisix-dashboard-2.4-0.x86_64.rpm
3232

3333
Packaging a Centos 7 package of APISIX's OpenResty distribution
3434
```sh
35-
make package type=rpm app=apisix-openresty version=1.19.3.2
35+
make package type=rpm app=apisix-openresty version=1.0.0
3636
ls output/
37-
apisix-openresty-1.19.3.2-0.x86_64.rpm
37+
apisix-openresty-1.0.0-0.x86_64.rpm
3838
```
3939

4040
## Details

build-apisix-openresty.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,13 @@ cd apisix-nginx-module/patch || exit 1
5454
./patch.sh ../../openresty-${or_ver}
5555
cd ../..
5656

57+
version=${version:-0.0.0}
5758
cc_opt=${cc_opt:-}
5859
ld_opt=${ld_opt:-}
5960

6061
cd openresty-${or_ver} || exit 1
6162
./configure --prefix="$OR_PREFIX" \
62-
--with-cc-opt="$cc_opt" \
63+
--with-cc-opt="-DAPISIX_OPENRESTY_VER=$version $cc_opt" \
6364
--with-ld-opt="$ld_opt" \
6465
--add-module=../mod_dubbo \
6566
--add-module=../ngx_multi_upstream_module \

dockerfiles/Dockerfile.apisix-openresty.rpm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ COPY build-apisix-openresty.sh /tmp/build-apisix-openresty.sh
88

99
WORKDIR /tmp
1010

11-
RUN ["/bin/sh", "-c", "./build-apisix-openresty-centos7.sh"]
11+
ARG version
12+
RUN version=${version} ./build-apisix-openresty-centos7.sh

0 commit comments

Comments
 (0)