This is an automated email from the ASF dual-hosted git repository.
albumenj 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 475ea077e Add Dockerfile for dubbo-samples-api (#1201)
475ea077e is described below
commit 475ea077ee04e994ed1f1c5c2f74ae12d65ed702
Author: Albumen Kevin <[email protected]>
AuthorDate: Fri Jan 3 17:45:30 2025 +0800
Add Dockerfile for dubbo-samples-api (#1201)
* Add Dockerfile for dubbo-samples-api
* Add Dockerfile for dubbo-samples-api
---
1-basic/dubbo-samples-api/Dockerfile | 27 +++++++++++
1-basic/dubbo-samples-api/pom.xml | 52 ++++++++++++----------
.../src/main/resources/log4j2.xml | 29 ------------
3 files changed, 55 insertions(+), 53 deletions(-)
diff --git a/1-basic/dubbo-samples-api/Dockerfile
b/1-basic/dubbo-samples-api/Dockerfile
new file mode 100644
index 000000000..aed987fe2
--- /dev/null
+++ b/1-basic/dubbo-samples-api/Dockerfile
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM maven:3.9.9 as builder
+
+ADD . /code
+WORKDIR /code
+RUN mvn clean package -B -DskipTests
+
+FROM openjdk:21-jdk
+
+COPY --from=builder /code/target/app-jar-with-dependencies.jar /app/app.jar
+EXPOSE 50052
+ENTRYPOINT exec java -jar /app/app.jar
diff --git a/1-basic/dubbo-samples-api/pom.xml
b/1-basic/dubbo-samples-api/pom.xml
index 0680b8746..0936dc0f0 100644
--- a/1-basic/dubbo-samples-api/pom.xml
+++ b/1-basic/dubbo-samples-api/pom.xml
@@ -40,8 +40,7 @@
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <dubbo.version>3.3.1</dubbo.version>
- <log4j2.version>2.20.0</log4j2.version>
+ <dubbo.version>3.3.2</dubbo.version>
<junit5.version>5.9.2</junit5.version>
</properties>
@@ -52,29 +51,11 @@
<version>${dubbo.version}</version>
</dependency>
- <!-- SLF4J API -->
+ <!-- Logback Dependency -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.30</version>
- </dependency>
- <!-- Log4j2 to SLF4J Bridge -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-slf4j-impl</artifactId>
- <version>${log4j2.version}</version>
- </dependency>
- <!-- Log4j2 Core -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- <version>${log4j2.version}</version>
- </dependency>
- <!-- Log4j2 API -->
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.5.15</version>
</dependency>
<dependency>
@@ -98,6 +79,7 @@
</dependencies>
<build>
+ <finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -108,6 +90,28 @@
</compilerArgs>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+
<mainClass>org.apache.dubbo.samples.provider.Application</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id> <!-- this is used for inheritance
merges -->
+ <phase>package</phase> <!-- bind to the packaging phase -->
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/1-basic/dubbo-samples-api/src/main/resources/log4j2.xml
b/1-basic/dubbo-samples-api/src/main/resources/log4j2.xml
deleted file mode 100644
index 69e1321d2..000000000
--- a/1-basic/dubbo-samples-api/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<Configuration status="WARN">
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT" follow="true">
- <PatternLayout pattern="%style{%d{HH:mm:ss.SSS}}{Magenta}
%style{|-}{White}%highlight{%-5p} [%t] %style{%40.40c}{Cyan}:%style{%-3L}{Blue}
%style{-|}{White}
%m%n%rEx{filters(jdk.internal.reflect,java.lang.reflect,sun.reflect)}"
disableAnsi="false" charset="UTF-8"/>
- </Console>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- </Root>
- </Loggers>
-</Configuration>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]