Deploy frontend stack
gitea/salix-front/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2022-03-30 15:29:20 +02:00
parent e5157aae6d
commit 87d265276a
3 changed files with 65 additions and 76 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
FROM node:stretch-slim
RUN npm install -g @quasar/cli
WORKDIR /app
COPY dist/spa ./
CMD ["quasar", "serve", "./", "--history"]

127
Jenkinsfile vendored
View File

@ -9,36 +9,36 @@ pipeline {
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
}
stages {
// stage('Checkout') {
// steps {
// script {
// switch (env.BRANCH_NAME) {
// case 'master':
// env.NODE_ENV = 'production'
// env.BACK_REPLICAS = 4
// break
// case 'test':
// env.NODE_ENV = 'test'
// env.BACK_REPLICAS = 2
// break
// }
// }
// configFileProvider([
// configFile(fileId: "salix.groovy",
// variable: 'GROOVY_FILE')
// ]) {
// load env.GROOVY_FILE
// }
// setEnv()
// }
// }
stage('Checkout') {
steps {
script {
switch (env.BRANCH_NAME) {
// case 'master':
// env.NODE_ENV = 'production'
// env.BACK_REPLICAS = 1
// break
case 'jest-ci':
env.NODE_ENV = 'test'
env.BACK_REPLICAS = 1
break
}
}
// configFileProvider([
// configFile(fileId: "salix.groovy",
// variable: 'GROOVY_FILE')
// ]) {
// load env.GROOVY_FILE
// }
setEnv()
}
}
stage('Install') {
environment {
NODE_ENV = ""
}
steps {
nodejs('node-v14') {
// sh 'npm install @quasar/cli'
sh 'npm install -g @quasar/cli'
sh 'npm install --no-audit --prefer-offline'
}
}
@ -68,48 +68,33 @@ pipeline {
// }
}
}
// stage('Build') {
// when { anyOf {
// branch 'test'
// branch 'master'
// }}
// environment {
// CREDENTIALS = credentials('docker-registry')
// }
// steps {
// nodejs('node-v14') {
// sh 'gulp build'
// }
// dockerBuild()
// }
// }
// stage('Deploy') {
// when { anyOf {
// branch 'test'
// branch 'master'
// }}
// environment {
// DOCKER_HOST = "${env.SWARM_HOST}"
// }
// steps {
// sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
// }
// }
// stage('Database') {
// when { anyOf {
// branch 'test'
// branch 'master'
// }}
// steps {
// configFileProvider([
// configFile(fileId: "config.${env.NODE_ENV}.ini",
// variable: 'MYSQL_CONFIG')
// ]) {
// sh 'cp "$MYSQL_CONFIG" db/config.$NODE_ENV.ini'
// }
// sh 'db/import-changes.sh -f $NODE_ENV'
// }
// }
stage('Build') {
when { anyOf {
branch 'jest-ci'
// branch 'master'
}}
environment {
CREDENTIALS = credentials('docker-registry')
}
steps {
nodejs('node-v14') {
sh 'quasar build'
}
dockerBuild()
}
}
stage('Deploy') {
when { anyOf {
branch 'jest-ci'
// branch 'master'
}}
environment {
DOCKER_HOST = "${env.SWARM_HOST}"
}
steps {
sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}"
}
}
}
post {
always {
@ -122,16 +107,6 @@ pipeline {
echo e.toString()
}
}
// if (!env.COMMITTER_EMAIL || currentBuild.currentResult == 'SUCCESS') return;
// try {
// mail(
// to: env.COMMITTER_EMAIL,
// subject: "Pipeline: ${env.JOB_NAME} (${env.BUILD_NUMBER}): ${currentBuild.currentResult}",
// body: "Check status at ${env.BUILD_URL}"
// )
// } catch (e) {
// echo e.toString()
// }
}
}
}

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: '3.7'
services:
main:
image: salix-front
build:
context: .
dockerfile: ./Dockerfile
ports:
- 4000