Wednesday 30 November 2022

Building Spring boot application manually and run it with the Docker Container


git clone https://github.com/callicoder/spring-boot-websocket-chat-demo.git

 cd spring-boot-websocket-chat-demo/

 cat Dockerfile

# Start with a base image containing Java runtime

FROM openjdk:11


# Add Maintainer Info

MAINTAINER Rajeev Kumar Singh <callicoder@gmail.com>


# Add a volume pointing to /tmp

VOLUME /tmp


# Make port 8080 available to the world outside this container

EXPOSE 8080


# The application's jar file

ARG JAR_FILE=target/websocket-demo-0.0.1-SNAPSHOT.jar


# Add the application's jar to the container

ADD ${JAR_FILE} websocket-demo.jar


# Run the jar file

ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/websocket-demo.jar"]


mvn clean package


sudo docker build -t webchat .


sudo docker images


sudo docker run -p 5000:8080 --name web_chat webchat


http://localhost:5000/


No comments:

Post a Comment