瀏覽代碼

fix: jenkins打包修改

mingliang.yang 3 周之前
父節點
當前提交
e9c3c9ebd7
共有 2 個文件被更改,包括 5 次插入20 次删除
  1. 1 15
      Dockerfile
  2. 4 5
      Jenkinsfile

+ 1 - 15
Dockerfile

@@ -1,20 +1,6 @@
-FROM node:18-alpine as build-stage
-
-WORKDIR /app
-RUN corepack enable
-RUN corepack prepare pnpm@8.6.10 --activate
-
-RUN npm config set registry https://registry.npmmirror.com
-
-COPY .npmrc package.json pnpm-lock.yaml ./
-RUN pnpm install --frozen-lockfile
-
-COPY . .
-RUN pnpm build
-
 FROM nginx:stable-alpine as production-stage
 
 COPY --from=build-stage /app/dist /usr/share/nginx/html
 EXPOSE 80
 
-CMD ["nginx", "-g", "daemon off;"]
+CMD ["nginx", "-g", "daemon off;"]

+ 4 - 5
Jenkinsfile

@@ -24,11 +24,10 @@ pipeline {
 
         stage('Publish Locally') {
             steps {
-               sh 'rm -rf /home/medic/dist'
-                // 将构建结果复制到本地目录(可自定义目录)
-                sh 'cp -r dist /home/medic'
-                // 解压dist.zip到指定目录
-                sh 'unzip /home/medic/dist.zip -d /home/medic/dist'
+               sh 'docker build --pull=false -t medicFornt .'
+               sh "docker stop medicFornt || true"
+               sh "docker rm medicFornt || true"
+               sh "docker run -d --name medicFornt -p 7889:80 medicFornt"
             }
         }
     }