Spring Boot Example Docker File

FROM openjdk:8-jdk-alpine3.9
#FOR PI 4
#FROM arm32v7/openjdk:8-alpine
RUN sed -i 's/TLSv1.2/TLSv1.0/g' /etc/ssl/openssl.cnf


#RUN addgroup -S spring && adduser -S spring -G spring
#USER spring:spring

###install bash shell
RUN apk --no-cache add bash

###install curl
RUN apk --no-cache add curl

##install psql client
RUN apk --no-cache add postgresql-client
##install mysql client
RUN apk --no-cache add mysql-client
#Download the desired package(s)
RUN curl -Ok https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.6.1.1-1_amd64.apk
RUN curl -Ok https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/mssql-tools_17.6.1.1-1_amd64.apk

#Install the package(s)
RUN apk --no-cache add --allow-untrusted msodbcsql17_17.6.1.1-1_amd64.apk
RUN apk --no-cache add --allow-untrusted mssql-tools_17.6.1.1-1_amd64.apk

##SET environment sqlcmd
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc

# Set volume point to /tmp
VOLUME /tmp

EXPOSE 8080
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} hellospring.jar

# Run the JAR file
#ENTRYPOINT ["java","-jar","/hellospring.jar"]
#For speed boot tomcat
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/hellospring.jar"]

if you want to change jar filename at the in pom file need to place if not exists

<project>
...
...
<build>
<finalName>nameOfJarFile</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.4.RELEASE</version>
</plugin>
</plugins>
</build>
</project>

--

--