Deploy simple front-end and back-end projects automatically through Jenkins

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

img.pngOnly maven is configured here. Personally, it is best to install jdk and nodejs globally (personally, I think it is inconvenient to install jenkins)img_1.png

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, img_2.png img_3.pngand set polling (check once every 5 minutes for updates) img_4.png. The back-end selects the built pom file, and the front-end execution is included in deploy.sh, just execute it directlyimg_6.png img_5.png

4. Build after saving

img_7.png img_8.png img_9.png img_10.pngbuild 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

Guess you like

Origin blog.csdn.net/Rakers1024/article/details/128074826