This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go-pixiu.git


The following commit(s) were added to refs/heads/develop by this push:
     new ad223d8b chore: update Dockerfile and optimize build process (#714)
ad223d8b is described below

commit ad223d8bd49516106ebdfc0894dd1ddb1b0c3feb
Author: Xuetao Li <[email protected]>
AuthorDate: Sun Aug 3 12:46:25 2025 +0800

    chore: update Dockerfile and optimize build process (#714)
---
 Dockerfile | 49 +++++++++++++++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 20 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index b71f940f..69508cea 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,37 +17,46 @@
 # under the License.
 #
 
-
-
 ### builder
-FROM amd64/ubuntu:latest as builder
+FROM golang:1.23.4-bookworm AS  builder
 LABEL MAINTAINER="[email protected]"
 
-RUN apt-get update && \
-    apt-get install -y --no-install-recommends gcc
+RUN apt-get update && apt-get install -y --no-install-recommends gcc
+
+WORKDIR /app
 
-ADD https://golang.google.cn/dl/go1.23.4.linux-amd64.tar.gz .
-RUN tar -xf go1.23.4.linux-amd64.tar.gz -C /usr/local/
-ENV PATH=$PATH:/usr/local/go/bin
+COPY go.mod go.sum ./
+RUN go mod download
 
-WORKDIR /app/
 COPY . .
 
-ENV GO111MODULE=on \
-    CGO_ENABLED=1 \
+ENV CGO_ENABLED=1 \
     GOOS=linux \
     GOARCH=amd64
 
-RUN go build -ldflags '-r ./lib -s -w' -tags="wasm" -trimpath -o 
dubbo-go-pixiu ./cmd/pixiu/*.go
+# Here I still remains "wasmer" tag, because we need to build the wasmer plugin
+# if wasm feature is removed in the future, this tag and following wasm 
related command can be removed
+RUN go build -ldflags '-r ./lib -s -w' -tags="wasmer" -trimpath -o 
/app/dubbo-go-pixiu ./cmd/pixiu/*.go
+
+RUN find /go/pkg/mod -name "libwasmer.so" -exec cp {} /app/libwasmer.so \;
+
+
+FROM pingcap/alpine-glibc:alpine-3.14.6
+LABEL MAINTAINER="[email protected]"
 
-### alpine
-FROM amd64/pingcap/alpine-glibc:latest
 RUN addgroup -S nonroot \
     && adduser -S nonroot -G nonroot
+
+WORKDIR /app
+COPY docker-entrypoint.sh .
+COPY configs ./configs
+
+COPY --from=builder /app/dubbo-go-pixiu .
+COPY --from=builder /app/libwasmer.so /lib/
+
+RUN chown -R nonroot:nonroot /app \
+    && chmod +x /app/docker-entrypoint.sh
+
 USER nonroot
-COPY docker-entrypoint.sh /
-COPY configs/* /etc/pixiu/
-COPY --from=builder 
/root/go/pkg/mod/github.com/wasmerio/[email protected]/wasmer/packaged/lib/linux-amd64/libwasmer.so
 /lib/
-COPY --from=builder /app/dubbo-go-pixiu /
-RUN ["chmod", "+x", "/docker-entrypoint.sh"]
-ENTRYPOINT ["sh","./docker-entrypoint.sh"]
+
+ENTRYPOINT ["/app/docker-entrypoint.sh"]
\ No newline at end of file

Reply via email to