From bc245e7c55f6c022658cdac8d168e64fe5db4e2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E9=A3=9E?= <2624970078@qq.com> Date: Sat, 29 May 2021 18:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Jenkinsfile=E5=92=8CDockerfil?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ Jenkinsfile | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ae70c08 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,2 @@ +FROM tiangolo/uwsgi-nginx-flask:python3.6 +ADD ./app /app \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..d43f4be --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,41 @@ +pipeline { + agent any + + stages { + + stage('pull code') { + steps { + echo 'pull code' + checkout([$class: 'GitSCM', branches: [[name: '*/SPM-Spring2021-2599-张小飞201831990641']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '15b0474b-b8eb-4574-9506-464f19a2b33e', url: 'https://github.com/lanlab-org/EnglishPal.git']]]) + } + } + stage('MakeDatabasefile') { + steps { + sh 'touch ./app/static/wordfreqapp.db && rm -f ./app/static/wordfreqapp.db' + sh 'cat ./app/static/wordfreqapp.sql | sqlite3 ./app/static/wordfreqapp.db' + } + } + stage('BuildIt') { + steps { + echo 'Building..' + sh 'sudo docker build -t englishpalzhangxf .' + sh 'sudo docker stop $(docker ps -aq)' + sh 'sudo docker run -d -p 5000:80 -t englishpalzhangxf' + } + } + stage('TestIt') { + steps { + echo 'Testing..' + sh 'sudo docker run -d -p 4444:4444 selenium/standalone-chrome' + sh 'pip3 install pytest -U -q' + sh 'pip3 install selenium -U -q' + sh 'python3 -m pytest -v -s ./code/test' + } + } + stage('DeployIt') { + steps { + echo 'Deploying....' + } + } + } +}