Scenario Overview

You want to deploy a Spring Boot JAR application with:


1. Infrastructure Setup

1.1 VMware

1.2 Linux Preparation

sudo apt update
sudo apt upgrade -y
sudo apt install -y docker.io docker-compose openjdk-17-jdk nginx certbot python3-certbot-nginx
sudo systemctl enable docker
sudo systemctl start docker


2. Dockerize Spring Boot Application

2.1 Create Dockerfile

Place this in the Spring Boot project root:

FROM openjdk:17-jdk-alpine
VOLUME /tmp
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]