Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.env.development
This commit is contained in:
2026-04-12 10:38:27 +08:00
5 changed files with 93 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
VITE_BASE_URL = 'http://192.168.123.199:5156'
+1 -1
View File
@@ -4,7 +4,7 @@ FROM nginx:alpine
RUN apk add --no-cache curl
COPY dist/ /usr/share/nginx/html/
RUN chmod -R 755 /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
Vendored
+1 -1
View File
@@ -3,7 +3,7 @@ pipeline {
environment {
IMAGE_NAME = 'lpt-fe:0.0'
CONTAINER_NAME = 'LPT_FE'
HOST_PORT = '5158'
HOST_PORT = '8157'
CONTAINER_PORT = '80'
}
stages {
+89
View File
@@ -0,0 +1,89 @@
pipeline {
agent none // 全局不指定,局部单独声明
environment {
IMAGE_NAME = 'lpt-fe:0.0'
CONTAINER_NAME = 'LPT_FE'
HOST_PORT = '8155'
CONTAINER_PORT = '80'
}
stages {
stage('Install Dependencies') {
agent {
docker {
image 'node:20-alpine'
args '-v ${WORKSPACE}/.npm:/.npm -v ${WORKSPACE}/node_modules:/app/node_modules'
}
}
steps {
sh '''
npm config set cache /.npm
npm install
'''
}
}
stage('Type Check & Build') {
agent {
docker {
image 'node:20-alpine'
args '-v ${WORKSPACE}/.npm:/.npm -v ${WORKSPACE}/node_modules:/app/node_modules'
}
}
steps {
sh '''
npm run type-check
npm run build:dev
'''
}
}
stage('Build Docker Image') {
agent any // Jenkins默认节点,有Docker命令
steps {
sh '''
docker build -t $IMAGE_NAME .
'''
}
}
stage('Run Docker Container') {
agent any
steps {
sh '''
docker rm -f $CONTAINER_NAME || true
docker run -d --name $CONTAINER_NAME \\
-p $HOST_PORT:$CONTAINER_PORT \\
--health-cmd="curl -f http://localhost:80 || exit 1" \\
--health-interval=5s \\
--health-retries=3 \\
--restart=always \\
$IMAGE_NAME
'''
}
}
stage('Check Docker Status') {
agent any
steps {
script {
def lastStatus = ''
timeout(time: 60, unit: 'SECONDS') {
waitUntil {
def status = sh(
script: "docker inspect -f '{{.State.Health.Status}}' $CONTAINER_NAME || echo 'unhealthy'",
returnStdout: true
).trim()
if (status != lastStatus) {
echo "Container health: ${status}"
lastStatus = status
}
return (status == 'healthy')
}
}
}
}
}
}
}
+1
View File
@@ -5,6 +5,7 @@
"type": "module",
"scripts": {
"dev": "vite --mode development",
"build:dev": "vite build --mode development",
"build": "vite build --mode production",
"preview": "vite preview",
"build-only": "vite build",