One-Click Remote Deployment of SpringBoot Projects Using IntelliJ IDEA and Docker
This tutorial explains how to set up IntelliJ IDEA and Docker for one‑click remote deployment of a SpringBoot application, comparing traditional jar deployment with the Docker‑based workflow, and walks through SSH configuration, Docker daemon basics, Dockerfile creation, and IDE deployment settings.
This article demonstrates how to use IntelliJ IDEA together with Docker to remotely deploy a SpringBoot project with a single click, offering a more efficient alternative to manually uploading and running jar files on a server.
Preparation steps include installing Docker on the server, installing IntelliJ IDEA locally, and having a runnable SpringBoot jar ready for demonstration.
Jar package deployment vs. remote deployment : Traditional jar deployment requires installing Java on the server, uploading the jar, and executing java -jar , which is cumbersome and makes log monitoring difficult. The IDEA+Docker approach configures the IDE once, after which deployment is triggered by clicking a green triangle, automatically building the image, pushing it, and starting the container while providing real‑time logs.
1) SSH configuration : Set up SSH in IDEA (File → Settings → Search "ssh"), preferably using a key pair for authentication, though password authentication is also possible.
2) Docker daemon connection : Configure the Docker daemon in IDEA (File → Settings → Search "docker") to manage containers, images, networks, and storage on the host.
3) Dockerfile creation :
# 基础镜像
FROM openjdk:17
# 复制主机jar包至镜像内,复制的目录需放置在 Dockerfile 文件同级目录下
ADD target/demo-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar","--spring.profiles.active=prod"]
EXPOSE 8080This Dockerfile builds an image based on OpenJDK 17, adds the compiled jar, sets the entry point, and exposes port 8080.
4) Remote deployment configuration in IDEA : Create a new deployment configuration, fill in the SSH and Docker settings, and specify the Dockerfile and image details. After saving, clicking the run button triggers the entire build‑and‑run process.
The final steps show the project being uploaded, the container starting, and the application responding to HTTP requests with logs visible in the IDE console, confirming that the one‑click deployment works as described.
Architecture Digest
Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.