Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitxon/java-spring-containerization
https://github.com/bitxon/java-spring-containerization
buildpack docker dockerfile java jib spring
Last synced: 9 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bitxon/java-spring-containerization
- Owner: bitxon
- Created: 2023-03-27T16:20:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-27T09:27:56.000Z (about 1 year ago)
- Last Synced: 2024-11-08T05:04:40.306Z (9 days ago)
- Topics: buildpack, docker, dockerfile, java, jib, spring
- Language: Java
- Homepage:
- Size: 184 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compare Java Spring Boot containerization options
* [Compare Java Spring Boot containerization options](#compare-java-spring-boot-containerization-options)
* [Application](#application)
* [Containerization](#containerization)
* [Gradle](#gradle)
* [From Jar](#from-jar)
* [Multistage](#multistage)
* [Multistage (Gradle Wrapper)](#multistage-gradle-wrapper)
* [Buildpack](#buildpack)
* [Jib](#jib)
* [Maven](#maven)
* [From Jar](#from-jar-1)
* [Multistage](#multistage-1)
* [Multistage (Maven Wrapper)](#multistage-maven-wrapper)
* [Buildpack](#buildpack-1)
* [Jib](#jib-1)---
## Application
this is simple hello-world application that expose two ports 8080, 8081```bash
curl http://localhost:8080/hello
curl http://localhost:8081/actuator/health
curl http://localhost:8081/actuator/info
```---
## Containerization### Gradle
#### From Jar
```bash
./gradlew clean build
docker build -f docker/Dockerfile.gradle-jar -t containerized-app:gradle-jar .
```#### Multistage
```bash
docker build -f docker/Dockerfile.gradle-multistage -t containerized-app:gradle-multistage .
```#### Multistage (Gradle Wrapper)
```bash
docker build -f docker/Dockerfile.gradlew-multistage -t containerized-app:gradlew-multistage .
```#### [Buildpack](https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#build-image.examples)
```bash
./gradlew bootBuildImage --imageName=containerized-app:gradle-buildpack
```
```bash
# Build image with git commit id as version
./gradlew bootBuildImage
```#### [Jib](https://github.com/GoogleContainerTools/jib/blob/master/jib-gradle-plugin/README.md)
```bash
./gradlew jibDockerBuild --image=containerized-app:gradle-jib
```### Maven
#### From Jar
```bash
./mvnw clean verify
docker build -f docker/Dockerfile.mvn-jar -t containerized-app:mvn-jar .
```#### Multistage
```bash
docker build -f docker/Dockerfile.mvn-multistage -t containerized-app:mvn-multistage .
```#### Multistage (Maven Wrapper)
```bash
docker build -f docker/Dockerfile.mvnw-multistage -t containerized-app:mvnw-multistage .
```#### [Buildpack](https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#build-image.examples)
```bash
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=containerized-app:mvn-buildpack
```
```bash
# Build image with git commit id as version
./mvnw spring-boot:build-image
```#### [Jib](https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/README.md)
```bash
./mvnw compile jib:dockerBuild -Dimage=containerized-app:mvn-jib
```