Skip to content

Commit c74898b

Browse files
author
litongjava
committed
update dockerfile
1 parent 43aa5de commit c74898b

File tree

2 files changed

+65
-141
lines changed

2 files changed

+65
-141
lines changed

frameworks/Java/tio-http-server/pom.xml

Lines changed: 62 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -56,144 +56,67 @@
5656
</dependency>
5757

5858
</dependencies>
59-
<profiles>
60-
<!-- 开发环境 -->
61-
<profile>
62-
<id>development</id>
63-
<activation>
64-
<activeByDefault>true</activeByDefault>
65-
</activation>
66-
<dependencies>
67-
<dependency>
68-
<groupId>ch.qos.logback</groupId>
69-
<artifactId>logback-classic</artifactId>
70-
<version>1.2.13</version>
71-
</dependency>
72-
</dependencies>
73-
</profile>
59+
<repositories>
60+
<repository>
61+
<id>central</id>
62+
<name>Central Repository</name>
63+
<url>https://repo.maven.apache.org/maven2</url>
64+
</repository>
65+
<repository>
66+
<id>sonatype-nexus-snapshots</id>
67+
<name>Sonatype Nexus Snapshots</name>
68+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
69+
</repository>
70+
</repositories>
71+
<pluginRepositories>
72+
<pluginRepository>
73+
<id>central</id>
74+
<name>Central Repository</name>
75+
<url>https://repo.maven.apache.org/maven2</url>
76+
</pluginRepository>
77+
<pluginRepository>
78+
<id>sonatype-nexus-snapshots</id>
79+
<name>Sonatype Nexus Snapshots</name>
80+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
81+
<releases>
82+
<enabled>false</enabled>
83+
</releases>
84+
<snapshots>
85+
<enabled>true</enabled>
86+
</snapshots>
87+
</pluginRepository>
88+
</pluginRepositories>
89+
<build>
90+
<plugins>
7491

75-
<!-- 生产环境 -->
76-
<profile>
77-
<id>production</id>
78-
<dependencies>
79-
<dependency>
80-
<groupId>ch.qos.logback</groupId>
81-
<artifactId>logback-classic</artifactId>
82-
<version>1.2.13</version>
83-
</dependency>
84-
</dependencies>
85-
<build>
86-
<plugins>
87-
<plugin>
88-
<groupId>org.springframework.boot</groupId>
89-
<artifactId>spring-boot-maven-plugin</artifactId>
90-
<version>2.7.4</version>
91-
<configuration>
92-
<mainClass>${main.class}</mainClass>
93-
<excludeGroupIds>org.projectlombok</excludeGroupIds>
94-
</configuration>
95-
<!-- 设置执行目标 -->
96-
<executions>
97-
<execution>
98-
<goals>
99-
<goal>repackage</goal>
100-
</goals>
101-
</execution>
102-
</executions>
103-
</plugin>
104-
</plugins>
105-
</build>
106-
</profile>
107-
<!-- assembly -->
108-
<profile>
109-
<id>assembly</id>
110-
<dependencies>
111-
<dependency>
112-
<groupId>ch.qos.logback</groupId>
113-
<artifactId>logback-classic</artifactId>
114-
<version>1.2.13</version>
115-
</dependency>
116-
</dependencies>
117-
<build>
118-
<plugins>
119-
<plugin>
120-
<groupId>org.apache.maven.plugins</groupId>
121-
<artifactId>maven-jar-plugin</artifactId>
122-
<version>3.2.0</version>
123-
</plugin>
124-
<plugin>
125-
<groupId>org.apache.maven.plugins</groupId>
126-
<artifactId>maven-assembly-plugin</artifactId>
127-
<version>3.1.1</version>
128-
<configuration>
129-
<archive>
130-
<manifest>
131-
<mainClass>${main.class}</mainClass>
132-
</manifest>
133-
</archive>
134-
<descriptorRefs>
135-
<descriptorRef>jar-with-dependencies</descriptorRef>
136-
</descriptorRefs>
137-
<appendAssemblyId>false</appendAssemblyId>
138-
</configuration>
139-
<executions>
140-
<execution>
141-
<id>make-assembly</id>
142-
<phase>package</phase>
143-
<goals>
144-
<goal>single</goal>
145-
</goals>
146-
</execution>
147-
</executions>
148-
</plugin>
149-
</plugins>
150-
</build>
151-
</profile>
152-
<profile>
153-
<id>native</id>
154-
<dependencies>
155-
<!-- GraalVM 环境使用 jdk log -->
156-
<dependency>
157-
<groupId>org.slf4j</groupId>
158-
<artifactId>slf4j-jdk14</artifactId>
159-
<version>1.7.31</version>
160-
</dependency>
161-
<!-- GraalVM -->
162-
<dependency>
163-
<groupId>org.graalvm.sdk</groupId>
164-
<artifactId>graal-sdk</artifactId>
165-
<version>${graalvm.version}</version>
166-
<scope>provided</scope>
167-
</dependency>
168-
</dependencies>
169-
<build>
170-
<finalName>${project.artifactId}</finalName>
171-
<plugins>
172-
<plugin>
173-
<groupId>org.graalvm.nativeimage</groupId>
174-
<artifactId>native-image-maven-plugin</artifactId>
175-
<version>21.2.0</version>
176-
<executions>
177-
<execution>
178-
<goals>
179-
<goal>native-image</goal>
180-
</goals>
181-
<phase>package</phase>
182-
</execution>
183-
</executions>
184-
<configuration>
185-
<skip>false</skip>
186-
<imageName>${project.artifactId}</imageName>
187-
<mainClass>${main.class}</mainClass>
188-
<buildArgs>
189-
-H:+RemoveSaturatedTypeFlows
190-
--allow-incomplete-classpath
191-
--no-fallback
192-
</buildArgs>
193-
</configuration>
194-
</plugin>
195-
</plugins>
196-
</build>
197-
</profile>
198-
</profiles>
92+
<plugin>
93+
<inherited>true</inherited>
94+
<groupId>org.apache.maven.plugins</groupId>
95+
<artifactId>maven-compiler-plugin</artifactId>
96+
<version>3.8.0</version>
97+
<configuration>
98+
<debug>false</debug>
99+
</configuration>
100+
</plugin>
101+
102+
<plugin>
103+
<artifactId>maven-assembly-plugin</artifactId>
104+
<version>3.1.0</version>
105+
<configuration>
106+
<descriptorRefs>
107+
<descriptorRef>jar-with-dependencies</descriptorRef>
108+
</descriptorRefs>
109+
</configuration>
110+
<executions>
111+
<execution>
112+
<id>make-assembly</id>
113+
<phase>package</phase>
114+
<goals>
115+
<goal>single</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
</plugins>
121+
</build>
199122
</project>

frameworks/Java/tio-http-server/tio-server.dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ FROM litongjava/jre:8u391-stable-slim
1212

1313
WORKDIR /app
1414

15-
COPY --from=builder /app/target/tio-http-server-benchmark-1.0.jar /app/target/tio-http-server-benchmark-1.0.jar
15+
COPY --from=builder /app/target/tio-http-server-benchmark-1.0-jar-with-dependencies.jar /app/tio-http-server-benchmark-1.0.jar
1616

1717
EXPOSE 8080
1818

19-
CMD ["java", "-Xms1G", "-Xmx1G", "-XX:+UseNUMA", "-XX:+UseParallelGC","-jar", "/app/target/tio-http-server-benchmark-1.0.jar"]
19+
# java --server -XX:+UseNUMA XX:+UseParallelGC -cp target/tio-http-server-benchmark-1.0-jar-with-dependencies.jar com.litongjava.tio.http.server.MainApp
20+
CMD ["java", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC","-cp", "/app/tio-http-server-benchmark-1.0.jar","com.litongjava.tio.http.server.MainApp"]

0 commit comments

Comments
 (0)