Deploy SpringBoot to Docker with Alibaba’s CloudToolkit Plugin – A Step‑by‑Step Guide
This guide introduces Alibaba’s free CloudToolkit IntelliJ IDEA plugin, explains how to install it, configure remote hosts, and use its built‑in terminal and deployment features to automatically package a SpringBoot application into a Docker image, upload scripts, and launch the container with one click.
What is CloudToolkit?
CloudToolkit is a free IntelliJ IDEA plugin released by Alibaba that simplifies automated deployment. It provides a built‑in terminal, file‑upload capabilities, and one‑click deployment to remote servers, making IDEA a lightweight alternative to Jenkins.
Installation
Search for Cloud Toolkit in the IDEA plugin marketplace and install it directly.
Using CloudToolkit for Automated Deployment
Prepare Dockerfile
# Base image
FROM java:8
# Copy jar into container
ADD mall-tiny-deploy-1.0-SNAPSHOT.jar /mall-tiny-deploy-1.0-SNAPSHOT.jar
# Expose port
EXPOSE 8088
# Run jar on container start
ENTRYPOINT ["java","-jar","/mall-tiny-deploy-1.0-SNAPSHOT.jar"]
# Maintainer
MAINTAINER macrozhengCreate run.sh Script
#!/usr/bin/env bash
# Application group
group_name='mall-tiny'
# Application name
app_name='mall-tiny-deploy'
# Version
app_version='1.0-SNAPSHOT'
# Environment
profile_active='prod'
echo '----copy jar----'
docker stop ${app_name}
echo '----stop container----'
docker rm ${app_name}
echo '----rm container----'
docker rmi ${group_name}/${app_name}:${app_version}
echo '----rm image----'
# Build Docker image
docker build -t ${group_name}/${app_name}:${app_version} .
echo '----build image----'
# Run container
docker run -p 8088:8088 --name ${app_name} \
--link mysql:db \
-e 'spring.profiles.active'=${profile_active} \
-e TZ="Asia/Shanghai" \
-v /etc/localtime:/etc/localtime \
-v /mydata/app/${app_name}/logs:/var/logs \
-d ${group_name}/${app_name}:${app_version}
echo '----start container----'Configure Remote Host
After installing the plugin, open the left‑side panel, right‑click the Host icon, and add the remote server’s connection details.
Upload Files and Execute
Upload mall‑tiny‑deploy‑1.0‑SNAPSHOT.jar and run.sh to the server and grant execution permission to run.sh.
In IDEA, right‑click the project and choose Deploy to Host.
Select the uploaded JAR as the artifact and, after the upload finishes, run run.sh from the built‑in terminal.
Verify Deployment
Open the Swagger UI at http://192.168.3.105:8088/swagger‑ui/ to confirm the application is running.
Common Features
The plugin includes an integrated terminal, allowing direct Linux server management from IDEA.
File upload replaces the need for external tools like WinSCP.
Conclusion
After proper configuration, CloudToolkit enables one‑click deployment of SpringBoot applications to remote servers, effectively acting as an IDEA‑based Jenkins. Its built‑in terminal and upload tools are highly convenient, making it a strong recommendation for developers seeking streamlined DevOps workflows.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
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.
