[skip ci] Dockerize section, how to handle different Dockerfile stages
This commit is contained in:
parent
ae34bec4df
commit
e2d1a9144b
1 changed files with 37 additions and 0 deletions
|
@ -39,6 +39,43 @@ build graalvm binary
|
||||||
curl -X GET localhost:8080
|
curl -X GET localhost:8080
|
||||||
2. graalvm native-image compilation
|
2. graalvm native-image compilation
|
||||||
./gradlew nativeCompile -Dvaadin.productionMode=true //-H:ConfigurationFileDirectories=/path/to/config-dir/ notwendig falls nicht in src/main/resources/META-INF/native-image/
|
./gradlew nativeCompile -Dvaadin.productionMode=true //-H:ConfigurationFileDirectories=/path/to/config-dir/ notwendig falls nicht in src/main/resources/META-INF/native-image/
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
Dockerizing -> image/Dockerfile
|
||||||
|
|
||||||
|
install buildx-plugin by binary to use build-native-stage only with DOCKER_BUILDKIT:
|
||||||
|
- https://github.com/docker/buildx/releases/download/v0.15.1/buildx-v0.15.1.linux-amd64
|
||||||
|
- sha256sum buildx-v0.15.1.linux-amd64
|
||||||
|
- move to file: mv buildx-v0.15.1.linux-amd64 $HOME/.docker/cli-plugins/docker-buildx
|
||||||
|
- chmod x $HOME/.docker/cli-plugins/docker-buildx
|
||||||
|
|
||||||
|
further:
|
||||||
|
It could be either build jar file or graalvm binary
|
||||||
|
|
||||||
|
(1)build-jar-stage
|
||||||
|
docker build --tag=meapp-jar --target=build-jar-stage .
|
||||||
|
(2)ENTRYPOINT as run-jar-stage
|
||||||
|
docker build --tag=run-meapp-jar --target=run-jar-stage
|
||||||
|
|
||||||
|
(3)build-native-stage
|
||||||
|
DOCKER_BUILDKIT=1 docker build --tag=meapp-native --target= build-native-stage .
|
||||||
|
(4)ENTRYPOINT as run-native-stage
|
||||||
|
DOCKER_BUILDKIT=1 docker build --tag=meapp-run-native --target=run-native-stage .
|
||||||
|
|
||||||
|
Test images:
|
||||||
|
docker run -e MEMBERNAMES=er,sie,es -p 8080:8080 run-jar-stage:latest
|
||||||
|
docker run -e MEMBERNAMES=er,sie,es -p 8080:8080 run-native-stage:latest
|
||||||
|
|
||||||
|
Buildkit caching:
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
--build-arg BUILDKIT_INLINE_CACHE=1
|
||||||
|
(1)docker build --tag=meapp-jar --target=build-jar-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
|
(2)docker build --tag=meapp-run-jar --target=run-jar-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
|
(3)docker build --tag=meapp-native --target=build-native-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
|
(4)docker build --tag=meapp-run-native --target=run-native-stage --build-arg BUILDKIT_INLINE_CACHE=1 .
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue