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"]

105
Jenkinsfile vendored
View File

@ -9,36 +9,36 @@ pipeline {
STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}" STACK_NAME = "${env.PROJECT_NAME}-${env.BRANCH_NAME}"
} }
stages { stages {
// stage('Checkout') { stage('Checkout') {
// steps { steps {
// script { script {
// switch (env.BRANCH_NAME) { switch (env.BRANCH_NAME) {
// case 'master': // case 'master':
// env.NODE_ENV = 'production' // env.NODE_ENV = 'production'
// env.BACK_REPLICAS = 4 // env.BACK_REPLICAS = 1
// break // break
// case 'test': case 'jest-ci':
// env.NODE_ENV = 'test' env.NODE_ENV = 'test'
// env.BACK_REPLICAS = 2 env.BACK_REPLICAS = 1
// break break
// } }
// } }
// configFileProvider([ // configFileProvider([
// configFile(fileId: "salix.groovy", // configFile(fileId: "salix.groovy",
// variable: 'GROOVY_FILE') // variable: 'GROOVY_FILE')
// ]) { // ]) {
// load env.GROOVY_FILE // load env.GROOVY_FILE
// } // }
// setEnv() setEnv()
// } }
// } }
stage('Install') { stage('Install') {
environment { environment {
NODE_ENV = "" NODE_ENV = ""
} }
steps { steps {
nodejs('node-v14') { nodejs('node-v14') {
// sh 'npm install @quasar/cli' sh 'npm install -g @quasar/cli'
sh 'npm install --no-audit --prefer-offline' sh 'npm install --no-audit --prefer-offline'
} }
} }
@ -68,48 +68,33 @@ pipeline {
// } // }
} }
} }
// stage('Build') { stage('Build') {
// when { anyOf { when { anyOf {
// branch 'test' branch 'jest-ci'
// branch 'master' // branch 'master'
// }} }}
// environment { environment {
// CREDENTIALS = credentials('docker-registry') CREDENTIALS = credentials('docker-registry')
// } }
// steps { steps {
// nodejs('node-v14') { nodejs('node-v14') {
// sh 'gulp build' sh 'quasar build'
// } }
// dockerBuild() dockerBuild()
// } }
// } }
// stage('Deploy') { stage('Deploy') {
// when { anyOf { when { anyOf {
// branch 'test' branch 'jest-ci'
// branch 'master' // branch 'master'
// }} }}
// environment { environment {
// DOCKER_HOST = "${env.SWARM_HOST}" DOCKER_HOST = "${env.SWARM_HOST}"
// } }
// steps { steps {
// sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" 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'
// }
// }
} }
post { post {
always { always {
@ -122,16 +107,6 @@ pipeline {
echo e.toString() 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