Looking at the company members, it takes a lot of time for deployment every time , and the work efficiency is low. I just want to improve work efficiency, so I try to build a jenkins front-end and back-end automatic deployment project. Very happy with the final build. Because the efficiency is improved more than a little. The following introduces the construction method (spring boot background and vite front end)
1. Configure maven, jdk and nodejs
Only maven is configured here. Personally, it is best to install jdk and nodejs globally (personally, I think it is inconvenient to install jenkins)
2. Store the deployed files in the project
deploy.sh
#!/bin/bash
cd src/ui/web &&
pnpm install --registry=https://registry.npm.taobao.org &&
pnpm run build &&
cd .. && cd .. &&
docker-compose -f docker-compose.yml up --build -d
Prepare docker-compose.yaml and Docker file, etc.
3. Create a project in jenkins
Fill in the git address, select the branch, and set polling (check once every 5 minutes for updates) . The back-end selects the built pom file, and the front-end execution is included in deploy.sh, just execute it directly
4. Build after saving
build successfully
This article was originally created by " Cheng Ge Blog " and complies with the CC 4.0 BY-SA copyright agreement. For reprinting, please attach the original source link and this statement.
Original link: Deploy simple front-end and back-end projects automatically through Jenkins