Deploy SpringBoot Apps to Docker with Alibaba’s CloudToolkit IDEA Plugin
This article walks through installing Alibaba's CloudToolkit IntelliJ IDEA plugin and using it to automate the packaging, upload, and one‑click deployment of a SpringBoot application to a Docker container on a remote server, including terminal and file‑transfer features.
What is CloudToolkit?
CloudToolkit is an Alibaba‑produced IntelliJ IDEA plugin that adds one‑click packaging and remote deployment capabilities, as well as an integrated terminal for managing Linux servers. The plugin is free and can be installed directly from the IDEA marketplace.
Installation
Open the IDEA plugin marketplace, search for “Cloud Toolkit”, and click Install.
Automated Deployment Workflow
The article demonstrates deploying a SpringBoot application to a Docker environment using CloudToolkit. The process includes preparing a Dockerfile, creating a run.sh script, uploading these files to the target server, and invoking the “Deploy to Host” action.
Dockerfile Example
# Base image
FROM java:8
# Copy jar
ADD mall-tiny-deploy-1.0-SNAPSHOT.jar /mall-tiny-deploy-1.0-SNAPSHOT.jar
# Expose port
EXPOSE 8088
# Entry point
ENTRYPOINT ["java","-jar","/mall-tiny-deploy-1.0-SNAPSHOT.jar"]
MAINTAINER macrozhengrun.sh Script
#!/usr/bin/env bash
group_name='mall-tiny'
app_name='mall-tiny-deploy'
app_version='1.0-SNAPSHOT'
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 image
docker build -t ${group_name}/${app_name}:${app_version} .
echo '----build image----'
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----'Upload the Dockerfile and run.sh to the Linux host, grant execution permission to run.sh, then right‑click the project and choose Deploy to Host. Select the Maven‑built JAR, upload it to the designated directory, and the plugin automatically runs run.sh.
Additional Features
Integrated terminal accessible via the “Terminal” button in the bottom panel.
File upload panel replaces the need for external tools such as WinSCP.
Result Verification
After deployment, open the Swagger UI at http://192.168.3.105:8088/swagger-ui/ to confirm the service is running.
Conclusion
After configuring CloudToolkit, a SpringBoot service can be built, packaged, and deployed to a remote Docker host with a single click, offering functionality comparable to Jenkins but directly inside IDEA.
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
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.
