Code Monkey home page Code Monkey logo

101-docker's People

Contributors

fanycastro avatar jabrena avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

101-docker's Issues

Testing Native features from Spring Boot 3.0 on OSX M1 with the help of Dashaun buildpack

POC:

pom.xml detail about native compilation:

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<image>
						<!--
						<builder>dashaun/java-native-builder-arm64:7.37.0</builder>
						-->
						<builder>dashaun/java-native-builder-multiarch:7.37.0</builder>
						<!--
						<buildpacks>
							<buildpack>gcr.io/paketo-buildpacks/bellsoft-liberica:9.10</buildpack>
							<buildpack>gcr.io/paketo-buildpacks/java-native-image</buildpack>
						</buildpacks>
						-->

					</image>
				</configuration>
			</plugin>

Environment:

uname -a                            
Darwin Juans-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:20 PDT 2021; root:xnu-7195.141.6~3/RELEASE_ARM64_T8101 arm64

docker version
Client:
 Cloud integration: v1.0.29
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:18 2022
 OS/Arch:           darwin/arm64
 Context:           default
 Experimental:      true

Server: Docker Desktop 4.14.0 (91374)
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:41 2022
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.9
  GitCommit:        1c90a442489720eec95342e1789ee8a5e1b9536f
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Execution in OSX M1:

mvn -Pnative spring-boot:build-image

Output in OSX M1:

[INFO] --- spring-boot-maven-plugin:3.0.0-RC2:build-image (default-cli) @ demo ---
[INFO] Building image 'docker.io/library/demo:0.0.1-SNAPSHOT'
[INFO] 
[INFO]  > Pulling builder image 'docker.io/dashaun/java-native-builder-multiarch:7.37.0' 100%
[INFO]  > Pulled builder image 'dashaun/java-native-builder-multiarch@sha256:aa747818e2697f02bfc506c1cd94707141e20e98ac4992407076317d358e1b80'
[INFO]  > Pulling run image 'docker.io/dashaun/stack-run:focal' 100%
[INFO]  > Pulled run image 'dashaun/stack-run@sha256:6f297a674961471c317e8bb163465862607b7a0737347a3de17aeb18d037ba1a'
[INFO]  > Executing lifecycle version v0.15.0
[INFO]  > Using build cache volume 'pack-cache-5cbe5692dbc4.build'
[INFO] 
[INFO]  > Running creator
[INFO]     [creator]     ===> ANALYZING
[INFO]     [creator]     Previous image with name "docker.io/library/demo:0.0.1-SNAPSHOT" not found
[INFO]     [creator]     ===> DETECTING
[INFO]     [creator]     6 of 14 buildpacks participating
[INFO]     [creator]     paketo-buildpacks/ca-certificates-arm64   3.4.0
[INFO]     [creator]     paketo-buildpacks/bellsoft-liberica-arm64 9.10.0
[INFO]     [creator]     paketo-buildpacks/syft-arm64              1.22.0
[INFO]     [creator]     paketo-buildpacks/executable-jar-arm64    6.5.0
[INFO]     [creator]     paketo-buildpacks/spring-boot-arm64       5.20.0
[INFO]     [creator]     paketo-buildpacks/native-image-arm64      5.6.0
[INFO]     [creator]     ===> RESTORING
[INFO]     [creator]     ===> BUILDING
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for CA Certificates 3.4.0
[INFO]     [creator]       https://github.com/paketo-buildpacks/ca-certificates
[INFO]     [creator]       Launch Helper: Contributing to layer
[INFO]     [creator]         Creating /layers/paketo-buildpacks_ca-certificates-arm64/helper/exec.d/ca-certificates-helper
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for BellSoft Liberica 9.10.0
[INFO]     [creator]       https://github.com/paketo-buildpacks/bellsoft-liberica
[INFO]     [creator]       Build Configuration:
[INFO]     [creator]         $BP_JVM_JLINK_ARGS           --no-man-pages --no-header-files --strip-debug --compress=1  configure custom link arguments (--output must be omitted)
[INFO]     [creator]         $BP_JVM_JLINK_ENABLED        false                                                        enables running jlink tool to generate custom JRE
[INFO]     [creator]         $BP_JVM_TYPE                 JRE                                                          the JVM type - JDK or JRE
[INFO]     [creator]         $BP_JVM_VERSION              11                                                           the Java version
[INFO]     [creator]       Launch Configuration:
[INFO]     [creator]         $BPL_DEBUG_ENABLED           false                                                        enables Java remote debugging support
[INFO]     [creator]         $BPL_DEBUG_PORT              8000                                                         configure the remote debugging port
[INFO]     [creator]         $BPL_DEBUG_SUSPEND           false                                                        configure whether to suspend execution until a debugger has attached
[INFO]     [creator]         $BPL_HEAP_DUMP_PATH                                                                       write heap dumps on error to this path
[INFO]     [creator]         $BPL_JAVA_NMT_ENABLED        true                                                         enables Java Native Memory Tracking (NMT)
[INFO]     [creator]         $BPL_JAVA_NMT_LEVEL          summary                                                      configure level of NMT, summary or detail
[INFO]     [creator]         $BPL_JFR_ARGS                                                                             configure custom Java Flight Recording (JFR) arguments
[INFO]     [creator]         $BPL_JFR_ENABLED             false                                                        enables Java Flight Recording (JFR)
[INFO]     [creator]         $BPL_JMX_ENABLED             false                                                        enables Java Management Extensions (JMX)
[INFO]     [creator]         $BPL_JMX_PORT                5000                                                         configure the JMX port
[INFO]     [creator]         $BPL_JVM_HEAD_ROOM           0                                                            the headroom in memory calculation
[INFO]     [creator]         $BPL_JVM_LOADED_CLASS_COUNT  35% of classes                                               the number of loaded classes in memory calculation
[INFO]     [creator]         $BPL_JVM_THREAD_COUNT        250                                                          the number of threads in memory calculation
[INFO]     [creator]         $JAVA_TOOL_OPTIONS                                                                        the JVM launch flags
[INFO]     [creator]         Using Java version 19 extracted from MANIFEST.MF
[INFO]     [creator]     
[INFO]     [creator]     Paketo Buildpack for BellSoft Liberica 9.10.0
[INFO]     [creator]       unable to find dependency
[INFO]     [creator]       no valid dependencies for native-image-svm, 19, and io.dashaun.stack.focal.arm64 in [(jdk, 8.0.352, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 8.0.352, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 11.0.17, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 11.0.17, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 11.0.17, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 17.0.5, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 17.0.5, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (native-image-svm, 17.0.5, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jdk, 19.0.1, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *]) (jre, 19.0.1, [io.buildpacks.stacks.bionic io.paketo.stacks.tiny *])]
[INFO]     [creator]     ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  30.967 s
[INFO] Finished at: 2022-11-12T18:36:41+01:00
[INFO] ------------------------------------------------------------------------

Note: I followed the notes from the article: https://dashaun.com/posts/paketo-aarch64-builder-spring-boot-3-rc1/

musl and spring-boot

  • [INFO] [creator] Error: Default native-compiler executable 'musl-gcc' not found via environment variable PATH
<BP_BINARY_COMPRESSION_METHOD>upx</BP_BINARY_COMPRESSION_METHOD>
<BP_NATIVE_IMAGE_BUILD_ARGUMENTS>--static --libc=musl</BP_NATIVE_IMAGE_BUILD_ARGUMENTS>

Spring native

2022-11-02T16:38:04.280Z ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.context.ApplicationContextException: Unable to start web server
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:164) ~[app:3.0.0-RC1]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:578) ~[app:6.0.0-RC2]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[app:3.0.0-RC1]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730) ~[app:3.0.0-RC1]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432) ~[app:3.0.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) ~[app:3.0.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302) ~[app:3.0.0-RC1]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291) ~[app:3.0.0-RC1]
	at com.example.benchmarks.BenchmarkServerJibber.main(BenchmarkServerJibber.java:18) ~[app:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to create tempDir. java.io.tmpdir is set to /tmp
	at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:208) ~[app:3.0.0-RC1]
	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:194) ~[app:3.0.0-RC1]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183) ~[app:3.0.0-RC1]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[app:3.0.0-RC1]
	... 8 common frames omitted
Caused by: java.nio.file.NoSuchFileException: /tmp/tomcat.8080.1228880437960241164
	at java.base@19/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:397) ~[app:na]
	at java.base@19/java.nio.file.Files.createDirectory(Files.java:700) ~[na:na]
	at java.base@19/java.nio.file.TempFileHelper.create(TempFileHelper.java:134) ~[na:na]
	at java.base@19/java.nio.file.TempFileHelper.createTempDirectory(TempFileHelper.java:171) ~[na:na]
	at java.base@19/java.nio.file.Files.createTempDirectory(Files.java:1017) ~[na:na]
	at org.springframework.boot.web.server.AbstractConfigurableWebServerFactory.createTempDir(AbstractConfigurableWebServerFactory.java:202) ~[app:3.0.0-RC1]
	... 11 common frames omitted

Review options to not touch code and change Server port by external configuration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.