Skip to content

Commit 475ea07

Browse files
authored
Add Dockerfile for dubbo-samples-api (#1201)
* Add Dockerfile for dubbo-samples-api * Add Dockerfile for dubbo-samples-api
1 parent 609d867 commit 475ea07

File tree

3 files changed

+55
-53
lines changed

3 files changed

+55
-53
lines changed

1-basic/dubbo-samples-api/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
FROM maven:3.9.9 as builder
18+
19+
ADD . /code
20+
WORKDIR /code
21+
RUN mvn clean package -B -DskipTests
22+
23+
FROM openjdk:21-jdk
24+
25+
COPY --from=builder /code/target/app-jar-with-dependencies.jar /app/app.jar
26+
EXPOSE 50052
27+
ENTRYPOINT exec java -jar /app/app.jar

1-basic/dubbo-samples-api/pom.xml

+28-24
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@
4040
<maven.compiler.target>17</maven.compiler.target>
4141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4242

43-
<dubbo.version>3.3.1</dubbo.version>
44-
<log4j2.version>2.20.0</log4j2.version>
43+
<dubbo.version>3.3.2</dubbo.version>
4544
<junit5.version>5.9.2</junit5.version>
4645
</properties>
4746

@@ -52,29 +51,11 @@
5251
<version>${dubbo.version}</version>
5352
</dependency>
5453

55-
<!-- SLF4J API -->
54+
<!-- Logback Dependency -->
5655
<dependency>
57-
<groupId>org.slf4j</groupId>
58-
<artifactId>slf4j-api</artifactId>
59-
<version>1.7.30</version>
60-
</dependency>
61-
<!-- Log4j2 to SLF4J Bridge -->
62-
<dependency>
63-
<groupId>org.apache.logging.log4j</groupId>
64-
<artifactId>log4j-slf4j-impl</artifactId>
65-
<version>${log4j2.version}</version>
66-
</dependency>
67-
<!-- Log4j2 Core -->
68-
<dependency>
69-
<groupId>org.apache.logging.log4j</groupId>
70-
<artifactId>log4j-core</artifactId>
71-
<version>${log4j2.version}</version>
72-
</dependency>
73-
<!-- Log4j2 API -->
74-
<dependency>
75-
<groupId>org.apache.logging.log4j</groupId>
76-
<artifactId>log4j-api</artifactId>
77-
<version>${log4j2.version}</version>
56+
<groupId>ch.qos.logback</groupId>
57+
<artifactId>logback-classic</artifactId>
58+
<version>1.5.15</version>
7859
</dependency>
7960

8061
<dependency>
@@ -98,6 +79,7 @@
9879
</dependencies>
9980

10081
<build>
82+
<finalName>app</finalName>
10183
<plugins>
10284
<plugin>
10385
<groupId>org.apache.maven.plugins</groupId>
@@ -108,6 +90,28 @@
10890
</compilerArgs>
10991
</configuration>
11092
</plugin>
93+
<plugin>
94+
<artifactId>maven-assembly-plugin</artifactId>
95+
<configuration>
96+
<descriptorRefs>
97+
<descriptorRef>jar-with-dependencies</descriptorRef>
98+
</descriptorRefs>
99+
<archive>
100+
<manifest>
101+
<mainClass>org.apache.dubbo.samples.provider.Application</mainClass>
102+
</manifest>
103+
</archive>
104+
</configuration>
105+
<executions>
106+
<execution>
107+
<id>make-assembly</id> <!-- this is used for inheritance merges -->
108+
<phase>package</phase> <!-- bind to the packaging phase -->
109+
<goals>
110+
<goal>single</goal>
111+
</goals>
112+
</execution>
113+
</executions>
114+
</plugin>
111115
</plugins>
112116
</build>
113117
</project>

1-basic/dubbo-samples-api/src/main/resources/log4j2.xml

-29
This file was deleted.

0 commit comments

Comments
 (0)