1 Star 0 Fork 12

行者 / OnceMi.Framework

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Jenkinsfile 1.49 KB
一键复制 编辑 原始数据 按行查看 历史
pipeline {
agent any
environment {
DOCKER_IMAGE_NAME = 'oncemi_framework_api'
EXPOSE_HTTP_PORT = '50000'
}
stages {
stage('Prepare') {
steps {
// Build this project.
sh 'echo Work directory is ${WORKSPACE}'
}
}
stage('Build') {
steps {
sh 'docker build -f ${WORKSPACE}/src/OnceMi.Framework.Api/Dockerfile -t ${DOCKER_IMAGE_NAME}:latest --force-rm ${WORKSPACE}/src'
}
}
stage('Deploy') {
steps {
sh '''\
echo '#!/bin/bash' > stop_container.sh \
&& echo 'if [ "$(docker ps -a -q -f name='${DOCKER_IMAGE_NAME}')" ]; then' >> stop_container.sh \
&& echo ' echo "The container '${DOCKER_IMAGE_NAME}' is running, stopping..."' >> stop_container.sh \
&& echo ' docker stop '${DOCKER_IMAGE_NAME} >> stop_container.sh \
&& echo ' docker rm '${DOCKER_IMAGE_NAME} >> stop_container.sh \
&& echo 'fi' >> stop_container.sh
'''
sh 'chmod +x stop_container.sh'
sh './stop_container.sh'
sh 'rm -rf stop_container.sh'
sh '''\
docker run -itd --name ${DOCKER_IMAGE_NAME} \
-p ${EXPOSE_HTTP_PORT}:80 \
-e "ASPNETCORE_ENVIRONMENT=Production" \
-e "ASPNETCORE_INITDB=true" \
-v /etc/localtime:/etc/localtime \
-v /data/oncemi/data:/oncemi/data \
-v /data/oncemi/logs:/app/logs \
--link redis:redis.docker.internal \
--link mysql:mysql.docker.internal \
oncemi_framework_api:latest
'''
}
}
}
}
C#
1
https://gitee.com/yushangbo/oncemi_framework.git
git@gitee.com:yushangbo/oncemi_framework.git
yushangbo
oncemi_framework
OnceMi.Framework
main

搜索帮助