Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fabianogoes/springboot-docker
Application Sample with Build generate Docker Image
https://github.com/fabianogoes/springboot-docker
Last synced: about 2 months ago
JSON representation
Application Sample with Build generate Docker Image
- Host: GitHub
- URL: https://github.com/fabianogoes/springboot-docker
- Owner: fabianogoes
- Created: 2018-01-09T22:49:38.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-10T20:21:58.000Z (almost 7 years ago)
- Last Synced: 2024-10-17T01:59:16.423Z (2 months ago)
- Language: Shell
- Size: 48.8 KB
- Stars: 2
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sample Application with Build generate Docker Image
**/src/main/dockerDockerfile**
```
FROM java:8
MAINTAINER Fabiano GóesLABEL version="1.0"
LABEL description="This is a base image to java application"
LABEL maintainer="[email protected]"
LABEL date-version="09/01/2018"ARG JAR_FILE_NAME
VOLUME /tmp
ADD /maven/${JAR_FILE_NAME}.jar app.jar
RUN bash -c 'touch /app.jar'
EXPOSE 8080ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-Dspring.profiles.active=container","-jar","/app.jar"]
```**pom.xml build plugin**
```xml
${project.artifactId}
org.springframework.boot
spring-boot-maven-plugin
io.fabric8
docker-maven-plugin
0.23.0
src/main/docker
${project.build.finalName}
true
${docker-image-prefix}/${project.artifactId}
Dockerfile
artifact
```**run maven build**
```
mvn clean package docker:build
```**image generated**
```
docker imagesREPOSITORY TAG IMAGE ID CREATED SIZE
logistic/springboot-docker latest b73c46b5bce3 About an hour ago 672MB
java 8 d23bdf5b1b1b 11 months ago 643MB
```**run application by docker container**
```
docker run -p 8080:8080 -d logistic/springboot-docker
```> view application running in: http://localhost:8080/
**verify container running**
```
docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
eed110c0a999 logistic/springboot-docker "java -Djava.secur..." 4 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp amazing_meitner
```**stop dpcker container**
```
docker stop eed110c0a999
```**remove docker container**
```
docker rm -f eed110c0a999
```### References
* [Spring Boot with Docker](https://spring.io/guides/gs/spring-boot-docker/)
* [RUNNING SPRING BOOT IN A DOCKER CONTAINER](https://springframework.guru/running-spring-boot-in-a-docker-container/#comment-2306)
* [Using Docker containers for your Spring boot applications](https://g00glen00b.be/docker-spring-boot/)
* [Dockerize Spring Boot Application](https://medium.com/sudharao/dockerize-spring-boot-application-deploy-spring-boot-application-to-docker-containerize-spring-e039a1aa743a)
* [Dockerize a Spring Boot application](https://thepracticaldeveloper.com/2017/12/11/dockerize-spring-boot/)
* [Dockerizing a Spring Boot Application by baeldung](http://www.baeldung.com/dockerizing-spring-boot-application)
* [fabric8io/docker-maven-plugin](https://dmp.fabric8.io/#example)
* [Docker Documentation](https://docs.docker.com/)