提交 b1431091 编写于 作者: LinuxSuRen's avatar LinuxSuRen

clone the codes by manul

上级 975d46ef
......@@ -5,19 +5,30 @@ pipeline {
environment {
IMAGE_TAG = ""
FOLDER = 'src/github.io/jenkins-zh'
}
stages{
stage("clone") {
steps {
dir(FOLDER) {
checkout scm
}
}
}
stage("build") {
environment {
GOPATH = "${WORKSPACE}"
}
steps {
container('golang'){
sh '''
CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -a -installsuffix cgo -o bin/wechat-backend
upx bin/wechat-backend
'''
dir(FOLDER) {
sh '''
CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -a -installsuffix cgo -o bin/wechat-backend
upx bin/wechat-backend
'''
}
}
}
}
......@@ -25,11 +36,13 @@ pipeline {
stage("image") {
steps {
container('golang'){
sh '''
IMAGE_TAG=$(git rev-parse --short HEAD)
docker build -t surenpi/jenkins-wechat:$IMAGE_TAG .
docker push surenpi/jenkins-wechat:$IMAGE_TAG
'''
dir(FOLDER) {
sh '''
IMAGE_TAG=$(git rev-parse --short HEAD)
docker build -t surenpi/jenkins-wechat:$IMAGE_TAG .
docker push surenpi/jenkins-wechat:$IMAGE_TAG
'''
}
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册