node('jenkins-jnlp') {
    //checkout源代码
    stage('Checkout') {
        checkout scm
    }
    //npm编译
    stage('Build npm') {
        sh "yarn install"
        sh "yarn run build:prod"
    }
    //dockerfile编译
    stage('Build docker') {
		try { sh "docker build -t shop-vite:latest -f deploy/Dockerfile ." } catch (e) {}
		try { sh "docker images | grep none | xargs -t -r docker rmi" } catch (e) {}
		try { sh "docker rm -f shop-vite" } catch (e) {}
		try { sh "docker run -it -d -p 9001:8080 --name shop-vite shop-vite:latest" } catch (e) {}
    }
}
