Travis CI - ARM64 架构上的 Spring Boot 应用程序

时间:2021-04-12 17:12:30

标签: java spring-boot docker maven travis-ci

我遇到了 Travis 构建无法运行的问题。但是 Build vor AMD64 运行完美...

这里是 AMD64 arch 的日志:

$ java -Xmx32m -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~16.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
$ javac -J-Xmx32m -version
javac 1.8.0_252
before_install.1
5.72s$ mvn clean

ARM64 的:

$ java -Xmx32m -version
/home/travis/.travis/functions: line 109: java: command not found
$ javac -J-Xmx32m -version
/home/travis/.travis/functions: line 109: javac: command not found
0.01s$ mvn clean
/home/travis/.travis/functions: line 109: mvn: command not found
The command "mvn clean" failed and exited with 127 during .

此外,我的 .travis.yml 看起来像这样:

#we use java
language: java
#we add the java development kit (jdk)
jdk:
- openjdk8

arch:
  - amd64
  - arm64

services:
#Linking Travis CI and Docker
- docker
before_install:
- mvn clean
- echo "$DOCKER_PASSWORD" | docker login  -u "$DOCKER_USERNAME" --password-stdin
- docker pull openjdk:8-jdk-alpine
script:
#We avoid this error :" the job exceeded the maximum log length and has been terminated "
- cp .travis.settings.xml $HOME/.m2/settings.xml
- cat $HOME/.m2/settings.xml
#deploying the app on Docker
- mvn deploy

如您所见,java、javac 和 mvn 无法正确识别...

这里是dockerfile:

# Start with a base image containing Java runtime
FROM openjdk:8-jdk-alpine

# Add Maintainer Info
LABEL maintainer="htl-grieskirchen"

# Add a volume pointing to /tmp
VOLUME /tmp

# Make port 8080 available to the world outside this container
EXPOSE 8080

# The application's jar file
ARG JAR_FILE

# Add the application's jar to the container
ADD ${JAR_FILE} app.jar

# Run the jar file 
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]

我希望有人能帮助我。 谢谢!

0 个答案:

没有答案