From accfb229af98753c79337d372768532ecd49b1b6 Mon Sep 17 00:00:00 2001 From: Odboy Date: Wed, 22 Jul 2026 21:06:38 +0800 Subject: [PATCH] =?UTF-8?q?feat(lua-client):=20=E6=96=B0=E5=A2=9E=20Lua=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=20SDK=20=E5=8F=8A=20demo=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Dockerfile=20=E6=9E=84=E5=BB=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile.lua | 18 +++++++--- README_DOCKERFILE.md | 2 +- .../kenaito-conf-1.0.3-1.rockspec | 36 +++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 kenaito-conf-lua-client/kenaito-conf-1.0.3-1.rockspec diff --git a/Dockerfile.lua b/Dockerfile.lua index ab92aad..6b9ebc5 100644 --- a/Dockerfile.lua +++ b/Dockerfile.lua @@ -1,10 +1,14 @@ # Build stage -FROM lua:5.4 AS build +FROM alpine:3.20 AS build WORKDIR /src -# Install build dependencies -RUN apk add --no-cache git +# Install Lua and dependencies +RUN apk add --no-cache lua5.4 lua5.4-dev luarocks5.4 git build-base + +# Create symlinks +RUN ln -sf /usr/bin/lua5.4 /usr/bin/lua && \ + ln -sf /usr/bin/luarocks-5.4 /usr/bin/luarocks # Copy client library COPY kenaito-conf-lua-client/ ./kenaito-conf-lua-client/ @@ -19,10 +23,16 @@ WORKDIR /src COPY kenaito-conf-lua-client-demo/ ./kenaito-conf-lua-client-demo/ # Runtime stage -FROM lua:5.4 +FROM alpine:3.20 WORKDIR /app +# Install Lua runtime +RUN apk add --no-cache lua5.4 + +# Create symlink +RUN ln -sf /usr/bin/lua5.4 /usr/bin/lua + # Copy Lua modules from build stage COPY --from=build /usr/local/share/lua/5.4 /usr/local/share/lua/5.4 COPY --from=build /usr/local/lib/lua/5.4 /usr/local/lib/lua/5.4 diff --git a/README_DOCKERFILE.md b/README_DOCKERFILE.md index 62390ea..2194ae4 100644 --- a/README_DOCKERFILE.md +++ b/README_DOCKERFILE.md @@ -86,7 +86,7 @@ docker run -it --rm \ kenaito-conf-perl-demo ``` -## Lua 客户端 +## Lua 客户端(测试通过) ```bash docker build -f Dockerfile.lua -t kenaito-conf-lua-demo . diff --git a/kenaito-conf-lua-client/kenaito-conf-1.0.3-1.rockspec b/kenaito-conf-lua-client/kenaito-conf-1.0.3-1.rockspec new file mode 100644 index 0000000..08a390c --- /dev/null +++ b/kenaito-conf-lua-client/kenaito-conf-1.0.3-1.rockspec @@ -0,0 +1,36 @@ +package = "kenaito-conf" +version = "1.0.3-1" + +source = { + url = "git://github.com/odboy/kenaito-conf.git", + tag = "v1.0.3", + dir = "kenaito-conf-lua-client" +} + +description = { + summary = "Kenaito Config Center Lua Client", + detailed = [[ + Lua client SDK for Kenaito Config Center. + Supports config fetching, caching, and change notification. + ]], + homepage = "https://github.com/odboy/kenaito-conf", + license = "Apache-2.0", + maintainer = "odboy " +} + +dependencies = { + "lua >= 5.1", + "luasocket", + "dkjson" +} + +build = { + type = "builtin", + modules = { + ["kenaito_conf"] = "kenaito_conf/init.lua", + ["kenaito_conf.client"] = "kenaito_conf/client.lua", + ["kenaito_conf.config"] = "kenaito_conf/config.lua", + ["kenaito_conf.cache"] = "kenaito_conf/cache.lua", + ["kenaito_conf.listener"] = "kenaito_conf/listener.lua" + } +}