Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The base image in the Dockerfile seems to be wrong #4621

Closed
shukawam opened this issue Jul 27, 2022 · 3 comments · Fixed by #4634
Closed

The base image in the Dockerfile seems to be wrong #4621

shukawam opened this issue Jul 27, 2022 · 3 comments · Fixed by #4634
Assignees
Labels
3.x Issues for 3.x version branch archetypes bug Something isn't working P2
Milestone

Comments

@shukawam
Copy link

Environment Details

  • Helidon Version: 3.0.0
  • Helidon MP
  • JDK version: 17.0.4
  • OS: Oracle Linux
  • Docker version (if applicable): 19.03.11-ol

Problem Description

The base image in the Dockerfile included in the quickstart generated from the Helidon CLI seems to be wrong.

  • jdk version should be 17+
# 1st stage, build the app
FROM maven:3.6-jdk-11 as build

WORKDIR /helidon

# Create a first layer to cache the "Maven World" in the local repository.
# Incremental docker builds will always resume after that, unless you update
# the pom
ADD pom.xml .
RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip

# Do the Maven build!
# Incremental docker builds will resume here when you change sources
ADD src src
RUN mvn package -DskipTests

RUN echo "done!"

# 2nd stage, build the runtime image
FROM openjdk:11-jre-slim
WORKDIR /helidon

# Copy the binary built in the 1st stage
COPY --from=build /helidon/target/quickstart-mp.jar ./
COPY --from=build /helidon/target/libs ./libs

CMD ["java", "-jar", "quickstart-mp.jar"]

EXPOSE 8080

Steps to reproduce

Firstly, I created skelton via helidon cli.

$ helidon init --version 3.0.0

| Helidon Flavor

Select a Flavor
  (1) se | Helidon SE
  (2) mp | Helidon MP
Enter selection (default: 1): 2

| Application Type

Select an Application Type
  (1) quickstart | Quickstart
  (2) database   | Database
  (3) custom     | Custom
Enter selection (default: 1): 1

| Media Support

Select a JSON library
  (1) jackson | Jackson
  (2) jsonb   | JSON-B
Enter selection (default: 1): 1

| Customize Project

Project groupId (default: me.opc-helidon): 
Project artifactId (default: quickstart-mp): 
Project version (default: 1.0-SNAPSHOT): 
Java package name (default: me.opc.mp.quickstart): 

Switch directory to /home/opc/git/quickstart-mp to use CLI

Start development loop? (default: n): n

Then, build the container image.

$ cd quickstart-mp/; docker build -t quickstart .
[+] Building 9.8s (13/16)                                                                                                               
 => [internal] load build definition from Dockerfile                                                                               0.0s
 => => transferring dockerfile: 846B                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                  0.0s
 => => transferring context: 107B                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/openjdk:11-jre-slim                                                             0.0s
 => [internal] load metadata for docker.io/library/maven:3.6-jdk-11                                                                0.0s
 => [build 1/7] FROM docker.io/library/maven:3.6-jdk-11                                                                            0.0s
 => [stage-1 1/4] FROM docker.io/library/openjdk:11-jre-slim                                                                       0.0s
 => CACHED [stage-1 2/4] WORKDIR /helidon                                                                                          0.0s
 => [internal] load build context                                                                                                  0.0s
 => => transferring context: 19.00kB                                                                                               0.0s
 => CACHED [build 2/7] WORKDIR /helidon                                                                                            0.0s
 => CACHED [build 3/7] ADD pom.xml .                                                                                               0.0s
 => CACHED [build 4/7] RUN mvn package -Dmaven.test.skip -Declipselink.weave.skip                                                  0.0s
 => CACHED [build 5/7] ADD src src                                                                                                 0.0s
 => ERROR [build 6/7] RUN mvn package -DskipTests                                                                                  9.8s
------                                                                                                                                  
 > [build 6/7] RUN mvn package -DskipTests:                                                                                             
#13 4.570 [INFO] Scanning for projects...                                                                                               
#13 5.720 [INFO] ------------------------------------------------------------------------                                               
#13 5.722 [INFO] Detecting the operating system and CPU architecture                                                                    
#13 5.724 [INFO] ------------------------------------------------------------------------                                               
#13 5.733 [INFO] os.detected.name: linux
#13 5.735 [INFO] os.detected.arch: x86_64
#13 5.735 [INFO] os.detected.version: 5.4
#13 5.736 [INFO] os.detected.version.major: 5
#13 5.743 [INFO] os.detected.version.minor: 4
#13 5.748 [INFO] os.detected.release: debian
#13 5.748 [INFO] os.detected.release.version: 10
#13 5.748 [INFO] os.detected.release.like.debian: true
#13 5.750 [INFO] os.detected.classifier: linux-x86_64
#13 5.784 [INFO] 
#13 5.784 [INFO] --------------------< me.opc-helidon:quickstart-mp >--------------------
#13 5.785 [INFO] Building quickstart-mp 1.0-SNAPSHOT
#13 5.786 [INFO] --------------------------------[ jar ]---------------------------------
#13 8.029 [INFO] 
#13 8.029 [INFO] --- maven-resources-plugin:2.7:resources (default-resources) @ quickstart-mp ---
#13 8.482 [INFO] Using 'UTF-8' encoding to copy filtered resources.
#13 8.502 [INFO] Copying 5 resources
#13 8.531 [INFO] 
#13 8.534 [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ quickstart-mp ---
#13 9.094 [INFO] Changes detected - recompiling the module!
#13 9.115 [INFO] Compiling 5 source files to /helidon/target/classes
#13 9.635 [INFO] ------------------------------------------------------------------------
#13 9.637 [INFO] BUILD FAILURE
#13 9.643 [INFO] ------------------------------------------------------------------------
#13 9.651 [INFO] Total time:  5.101 s
#13 9.655 [INFO] Finished at: 2022-07-27T01:41:46Z
#13 9.656 [INFO] ------------------------------------------------------------------------
#13 9.660 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project quickstart-mp: Fatal error compiling: error: release version 17 not supported -> [Help 1]
#13 9.668 [ERROR] 
#13 9.668 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
#13 9.669 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
#13 9.669 [ERROR] 
#13 9.669 [ERROR] For more information about the errors and possible solutions, please read the following articles:
#13 9.670 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
------
failed to solve with frontend dockerfile.v0: failed to build LLB: executor failed running [/bin/sh -c mvn package -DskipTests]: runc did not terminate sucessfully
@romain-grecourt
Copy link
Contributor

Indeed ; it should be maven:3.8.4-openjdk-17-slim instead of maven:3.6-jdk-11

@romain-grecourt romain-grecourt added bug Something isn't working 3.x Issues for 3.x version branch archetypes labels Jul 27, 2022
@m0mus m0mus added the P2 label Jul 28, 2022
@tomas-langer
Copy link
Member

Files that are impacted:
mp-tutorial.adoc
Dockerfile.mustache

@barchetta
Copy link
Member

./archetypes/helidon/src/main/archetype/common/files/Dockerfile.jlink.mustache:FROM maven:3.6.3-jdk-11-slim as build
./archetypes/helidon/src/main/archetype/common/files/Dockerfile.mustache:FROM maven:3.6-jdk-11 as build
./docs/mp/guides/mp-tutorial.adoc:FROM maven:3.6-jdk-11 as build <1>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Issues for 3.x version branch archetypes bug Something isn't working P2
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants