Skip to content

Commit

Permalink
删除native-image相关
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinDai committed May 21, 2024
1 parent 16afd06 commit 1d462df
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 90 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build -f docker/Dockerfile -t wechatrobot:$(date +%s) .
- name: Build the native-image Docker image
run: docker build -f docker/native-image-Dockerfile -t wechatrobot-native:$(date +%s) .
run: docker build -f docker/Dockerfile -t wechatrobot:$(date +%s) .
8 changes: 1 addition & 7 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,4 @@ jobs:
distribution: 'temurin'
cache: 'maven'
- name: build jar
run: mvn -B package --file pom.xml
- uses: graalvm/setup-graalvm@v1
with:
java-version: '17.0.7'
distribution: 'graalvm'
- name: build native image
run: mvn -B package -P native-image --file pom.xml
run: mvn -B package --file pom.xml
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,6 @@ nohup java -jar weChatRobot.jar > ./console.log 2>&1 &

在执行命令的当前目录查看console日志

### native-image运行

构建native-image(需要[graalvm版本的jdk](https://www.graalvm.org/downloads/))

```shell
mvn clean package -P native-image
```

构建完成后,在robot-web/target目录会生成weChatRobot可执行文件,可以直接运行

```shell
./weChatRobot
```

**注意:native-image不支持通过-D指定配置**

### Docker运行

构建适用于当前操作系统架构的镜像
Expand All @@ -119,8 +103,6 @@ docker build -f docker/Dockerfile --no-cache -t wechatrobot:latest .
docker buildx build -f docker/Dockerfile --no-cache -t wechatrobot:latest --platform=linux/amd64 -o type=docker .
```

如果需要构建native-image的镜像,替换上面命令中的`docker/Dockerfile``docker/native-image-Dockerfile`即可

后台运行镜像

```shell
Expand Down
23 changes: 0 additions & 23 deletions docker/native-image-Dockerfile

This file was deleted.

39 changes: 0 additions & 39 deletions robot-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,45 +72,6 @@
</plugins>
</build>
</profile>
<profile>
<id>native-image</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<version>21.2.0</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>weChatRobot</imageName>
<mainClass>com.doodl6.wechatrobot.MainVerticle</mainClass>
<buildArgs>
-H:+PrintClassInitialization
-H:+ReportExceptionStackTraces
-H:IncludeResources=static/index.html
-H:IncludeResources=static/images/qrcode.jpg
-H:IncludeResources=config.yml
-H:IncludeResources=keyword.json
-H:IncludeResources=keyword_version.txt
-H:ReflectionConfigurationFiles=classes/reflect.json
--no-fallback
--initialize-at-run-time=io.netty.handler.codec.compression.ZstdOptions
--initialize-at-run-time=io.netty.handler.ssl.BouncyCastleAlpnSslUtils
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>



</project>

0 comments on commit 1d462df

Please sign in to comment.