This is an automated email from the ASF dual-hosted git repository.
zrlw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git
The following commit(s) were added to refs/heads/master by this push:
new 78ae8895b Set `APP_FILE` variable at the same build stage of
dubbo-samples-native-image dockerfiles `COPY` instruction (#1274)
78ae8895b is described below
commit 78ae8895b328c8ccd15b70dbee24f3854fc409b1
Author: zrlw <[email protected]>
AuthorDate: Wed Nov 19 14:01:09 2025 +0800
Set `APP_FILE` variable at the same build stage of
dubbo-samples-native-image dockerfiles `COPY` instruction (#1274)
---
.../dubbo-samples-native-image-consumer/Dockerfile | 8 ++++++--
.../dubbo-samples-native-image-consumer/README.md | 2 +-
.../dubbo-samples-native-image-provider/Dockerfile | 8 ++++++--
.../dubbo-samples-native-image-provider/README.md | 2 +-
4 files changed, 14 insertions(+), 6 deletions(-)
diff --git
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/Dockerfile
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/Dockerfile
index 91a93d6b6..5b60cbf22 100644
---
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/Dockerfile
+++
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/Dockerfile
@@ -16,6 +16,10 @@ FROM container-registry.oracle.com/os/oraclelinux:9-slim
EXPOSE 9091
-# Copy the native executable into the containers (source file name could not
contain variables)
-COPY --from=builder /build/target/dubbo-samples-native-image-consumer app
+# The `APP_FILE` variable used in `COPY` instruction should be set at the same
build stage (`FROM` ...) of the `COPY` instruction
+ARG APP_FILE
+RUN echo "Set ARG APP_FILE=${APP_FILE} at the same build stage ('FROM ...') of
COPY instruction"
+
+# Copy the native executable into the containers
+COPY --from=builder /build/target/${APP_FILE} app
ENTRYPOINT ["/app"]
diff --git
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/README.md
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/README.md
index 8e4039d78..735dab5bd 100644
---
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/README.md
+++
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-consumer/README.md
@@ -8,7 +8,7 @@ To do this, we've provided a [multistage Docker build
file](./Dockerfile) for bu
1. Containerise the native executable using the following command:
```shell
- docker build -f ./Dockerfile -t consumer-native:1.0.0 .
+ docker build -f ./Dockerfile --build-arg
APP_FILE=dubbo-samples-native-image-consumer -t consumer-native:1.0.0 .
```
2. Run the application:
diff --git
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/Dockerfile
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/Dockerfile
index 94de1da44..31381c102 100644
---
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/Dockerfile
+++
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/Dockerfile
@@ -16,6 +16,10 @@ FROM container-registry.oracle.com/os/oraclelinux:9-slim
EXPOSE 50052
-# Copy the native executable into the containers (source file name could not
contain variables)
-COPY --from=builder /build/target/dubbo-samples-native-image-provider app
+# The `APP_FILE` variable used in `COPY` instruction should be set at the same
build stage (`FROM` ...) of the `COPY` instruction
+ARG APP_FILE
+RUN echo "Set ARG APP_FILE=${APP_FILE} at the same build stage ('FROM ...') of
COPY instruction"
+
+# Copy the native executable into the containers
+COPY --from=builder /build/target/${APP_FILE} app
ENTRYPOINT ["/app"]
diff --git
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/README.md
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/README.md
index b9dd39cd5..1f8ee605a 100644
---
a/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/README.md
+++
b/2-advanced/dubbo-samples-native-image/dubbo-samples-native-image-provider/README.md
@@ -8,7 +8,7 @@ To do this, we've provided a [multistage Docker build
file](./Dockerfile) for bu
1. Containerise the native executable using the following command:
```shell
- docker build -f ./Dockerfile -t provider-native:1.0.0 .
+ docker build -f ./Dockerfile --build-arg
APP_FILE=dubbo-samples-native-image-provider -t provider-native:1.0.0 .
```
2. Run the application:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]