Scenario Overview
You want to deploy a Spring Boot JAR application with:
- Secure HTTPS access
- Reverse proxy (NGINX)
- Containerized environment (Docker + Docker Compose)
- Running on a Linux VM inside VMware
- Cloud-ready deployment
1. Infrastructure Setup
1.1 VMware
- Provision a Linux VM (Ubuntu 22.04 recommended)
- Recommended resources: 2 CPU, 4GB RAM, 20GB disk
- Network: NAT or Bridged (public IP if needed)
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"]