Skip to content

Commit

Permalink
Add Dockerfile for dubbo-samples-api (#1201)
Browse files Browse the repository at this point in the history
* Add Dockerfile for dubbo-samples-api

* Add Dockerfile for dubbo-samples-api
  • Loading branch information
AlbumenJ authored Jan 3, 2025
1 parent 609d867 commit 475ea07
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 53 deletions.
27 changes: 27 additions & 0 deletions 1-basic/dubbo-samples-api/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
52 changes: 28 additions & 24 deletions 1-basic/dubbo-samples-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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>
Expand All @@ -98,6 +79,7 @@
</dependencies>

<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -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>
29 changes: 0 additions & 29 deletions 1-basic/dubbo-samples-api/src/main/resources/log4j2.xml

This file was deleted.

0 comments on commit 475ea07

Please sign in to comment.