alovoa icon indicating copy to clipboard operation
alovoa copied to clipboard

ARMv8 docker build failure

Open emailyc opened this issue 1 year ago • 1 comments

I want to experiment with hosting a server running on a Raspberry Pi or Apple Silicon Mac. I tried building the docker image by tweaking the base Maven image to one that supports ARMv8 but have no success.

# Build stage
FROM maven:3-amazoncorretto-17 AS build
ENV HOME=/home/app
WORKDIR $HOME
COPY pom.xml $HOME
RUN mvn verify --fail-never
COPY . /home/app
RUN mvn clean install -Dmaven.test.skip=true

# App stage
FROM eclipse-temurin:17.0.6_10-jre
ENV HOME=/home/app
WORKDIR $HOME
COPY --from=build $HOME/target/alovoa-1.1.0.jar $HOME/alovoa-1.1.0.jar
ENTRYPOINT ["java", "-XX:+HeapDumpOnOutOfMemoryError", "-Xmx128m", "-jar", "-Dfile.encoding=UTF-8", "-Dspring.profiles.active=prod", "alovoa-1.1.0.jar"]

I see the following error trying to build the image on a M2 MacBook Pro:

[+] Building 4.0s (12/14)                                                                                                                                                                                                                                                      docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                                           0.0s
 => => transferring dockerfile: 607B                                                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/library/eclipse-temurin:17.0.6_10-jre                                                                                                                                                                                                               0.4s
 => [internal] load metadata for docker.io/library/maven:3-amazoncorretto-17                                                                                                                                                                                                                   0.4s
 => [build 1/6] FROM docker.io/library/maven:3-amazoncorretto-17@sha256:5b9cd0ec42c3d2b436200acc5cf16b4285e2d9d6dd15a4e2fb393395583a9114                                                                                                                                                       0.0s
 => [stage-1 1/3] FROM docker.io/library/eclipse-temurin:17.0.6_10-jre@sha256:f2d58a6c3272ccf5e00753e9bd035446c4ad3871ee1d5dc6a121917213fb3691                                                                                                                                                 0.0s
 => [internal] load build context                                                                                                                                                                                                                                                              0.0s
 => => transferring context: 35.35kB                                                                                                                                                                                                                                                           0.0s
 => CACHED [build 2/6] WORKDIR /home/app                                                                                                                                                                                                                                                       0.0s
 => CACHED [build 3/6] COPY pom.xml /home/app                                                                                                                                                                                                                                                  0.0s
 => CACHED [build 4/6] RUN mvn verify --fail-never                                                                                                                                                                                                                                             0.0s
 => [build 5/6] COPY . /home/app                                                                                                                                                                                                                                                               0.1s
 => ERROR [build 6/6] RUN mvn clean install -Dmaven.test.skip=true                                                                                                                                                                                                                             3.4s
------                                                                                                                                                                                                                                                                                              
 > [build 6/6] RUN mvn clean install -Dmaven.test.skip=true:                                                                                                                                                                                                                                        
0.569 [INFO] Scanning for projects...                                                                                                                                                                                                                                                               
0.654 [INFO]                                                                                                                                                                                                                                                                                        
0.654 [INFO] -------------------------< com.alovoa:alovoa >--------------------------                                                                                                                                                                                                               
0.654 [INFO] Building alovoa 1.1.0                                                                                                                                                                                                                                                                  
0.654 [INFO]   from pom.xml
0.654 [INFO] --------------------------------[ jar ]---------------------------------
0.757 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.2.0/maven-clean-plugin-3.2.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.2.0/maven-clean-plugin-3.2.0.pom (5.3 kB at 33 kB/s)
0.921 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/35/maven-plugins-35.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/35/maven-plugins-35.pom (9.9 kB at 582 kB/s)
0.940 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/35/maven-parent-35.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/35/maven-parent-35.pom (45 kB at 1.2 MB/s)
0.979 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/25/apache-25.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/25/apache-25.pom (21 kB at 790 kB/s)
1.008 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.2.0/maven-clean-plugin-3.2.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/3.2.0/maven-clean-plugin-3.2.0.jar (36 kB at 1.6 MB/s)
1.052 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/3.0.1/maven-install-plugin-3.0.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/3.0.1/maven-install-plugin-3.0.1.pom (7.5 kB at 497 kB/s)
1.067 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/36/maven-plugins-36.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugins/36/maven-plugins-36.pom (9.9 kB at 619 kB/s)
1.084 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/36/maven-parent-36.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/36/maven-parent-36.pom (45 kB at 2.2 MB/s)
1.107 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/apache/26/apache-26.pom
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/apache/26/apache-26.pom (21 kB at 1.4 MB/s)
1.125 Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/3.0.1/maven-install-plugin-3.0.1.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/3.0.1/maven-install-plugin-3.0.1.jar (30 kB at 1.8 MB/s)
1.384 [INFO] 
1.384 [INFO] --- clean:3.2.0:clean (default-clean) @ alovoa ---
1.409 [INFO] 
1.409 [INFO] --- jacoco:0.8.10:prepare-agent (jacoco-initialize) @ alovoa ---
1.443 [INFO] argLine set to -javaagent:/root/.m2/repository/org/jacoco/org.jacoco.agent/0.8.10/org.jacoco.agent-0.8.10-runtime.jar=destfile=/home/app/target/jacoco.exec
1.443 [INFO] 
1.443 [INFO] --- resources:3.3.1:resources (default-resources) @ alovoa ---
1.466 [INFO] Copying 1 resource from src/main/resources to target/classes
1.477 [INFO] Copying 187 resources from src/main/resources to target/classes
1.489 [INFO] 
1.489 [INFO] --- compiler:3.10.1:compile (default-compile) @ alovoa ---
1.525 [INFO] Changes detected - recompiling the module!
1.526 [INFO] Compiling 144 source files to /home/app/target/classes
3.295 [INFO] 
3.295 [INFO] --- resources:3.3.1:testResources (default-testResources) @ alovoa ---
3.296 [INFO] Not copying test resources
3.296 [INFO] 
3.296 [INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ alovoa ---
3.298 [INFO] Not compiling test sources
3.298 [INFO] 
3.298 [INFO] --- surefire:2.22.2:test (default-test) @ alovoa ---
3.347 [INFO] Tests are skipped.
3.347 [INFO] 
3.347 [INFO] --- jacoco:0.8.10:report (jacoco-site) @ alovoa ---
3.349 [INFO] Skipping JaCoCo execution due to missing execution data file.
3.349 [INFO] 
3.349 [INFO] --- minify:2.0.1:minify (default-minify) @ alovoa ---
3.373 [INFO] ------------------------------------------------------------------------
3.373 [INFO] BUILD FAILURE
3.373 [INFO] ------------------------------------------------------------------------
3.376 [INFO] Total time:  2.813 s
3.377 [INFO] Finished at: 2023-11-09T10:08:39Z
3.377 [INFO] ------------------------------------------------------------------------
3.377 [ERROR] Failed to execute goal com.github.buckelieg:minify-maven-plugin:2.0.1:minify (default-minify) on project alovoa: Execution default-minify of goal com.github.buckelieg:minify-maven-plugin:2.0.1:minify failed: A required class was missing while executing com.github.buckelieg:minify-maven-plugin:2.0.1:minify: org/codehaus/plexus/util/DirectoryScanner
3.377 [ERROR] -----------------------------------------------------
3.377 [ERROR] realm =    plugin>com.github.buckelieg:minify-maven-plugin:2.0.1
3.377 [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
3.377 [ERROR] urls[0] = file:/root/.m2/repository/com/github/buckelieg/minify-maven-plugin/2.0.1/minify-maven-plugin-2.0.1.jar
3.377 [ERROR] urls[1] = file:/root/.m2/repository/com/yahoo/platform/yui/yuicompressor/2.4.8/yuicompressor-2.4.8.jar
3.377 [ERROR] urls[2] = file:/root/.m2/repository/rhino/js/1.7R2/js-1.7R2.jar
3.377 [ERROR] urls[3] = file:/root/.m2/repository/com/google/javascript/closure-compiler/v20190929/closure-compiler-v20190929.jar
3.377 [ERROR] urls[4] = file:/root/.m2/repository/com/google/javascript/closure-compiler-externs/v20190929/closure-compiler-externs-v20190929.jar
3.377 [ERROR] urls[5] = file:/root/.m2/repository/args4j/args4j/2.0.26/args4j-2.0.26.jar
3.377 [ERROR] urls[6] = file:/root/.m2/repository/com/google/errorprone/error_prone_annotations/2.3.1/error_prone_annotations-2.3.1.jar
3.377 [ERROR] urls[7] = file:/root/.m2/repository/com/google/guava/guava/25.1-jre/guava-25.1-jre.jar
3.377 [ERROR] urls[8] = file:/root/.m2/repository/org/checkerframework/checker-qual/2.0.0/checker-qual-2.0.0.jar
3.377 [ERROR] urls[9] = file:/root/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar
3.377 [ERROR] urls[10] = file:/root/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar
3.377 [ERROR] urls[11] = file:/root/.m2/repository/com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2.jar
3.377 [ERROR] urls[12] = file:/root/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar
3.377 [ERROR] urls[13] = file:/root/.m2/repository/com/google/jsinterop/jsinterop-annotations/1.0.0/jsinterop-annotations-1.0.0.jar
3.377 [ERROR] urls[14] = file:/root/.m2/repository/com/google/re2j/re2j/1.3/re2j-1.3.jar
3.377 [ERROR] urls[15] = file:/root/.m2/repository/com/google/code/gson/gson/2.8.6/gson-2.8.6.jar
3.377 [ERROR] Number of foreign imports: 1
3.377 [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
3.377 [ERROR] 
3.378 [ERROR] -----------------------------------------------------
3.378 [ERROR] : org.codehaus.plexus.util.DirectoryScanner
3.378 [ERROR] -> [Help 1]
3.378 [ERROR] 
3.378 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
3.378 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
3.378 [ERROR] 
3.378 [ERROR] For more information about the errors and possible solutions, please read the following articles:
3.378 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
------
Dockerfile:10
--------------------
   8 |     RUN mvn verify --fail-never
   9 |     COPY . /home/app
  10 | >>> RUN mvn clean install -Dmaven.test.skip=true
  11 |     
  12 |     #
--------------------
ERROR: failed to solve: process "/bin/sh -c mvn clean install -Dmaven.test.skip=true" did not complete successfully: exit code: 1

emailyc avatar Nov 09 '23 11:11 emailyc