Compare commits

..

2 Commits

Author SHA1 Message Date
a78de2fbd5 updated
Some checks failed
gitea_dndsources/schedulord-frontend/pipeline/head There was a failure building this commit
2022-06-09 10:20:46 +02:00
d25b04d44a Cleaning up 2022-06-09 10:06:50 +02:00
2 changed files with 62 additions and 85 deletions

View File

@ -1,25 +1,6 @@
# STEP 1: FROM nginx:1.13.1-alpine
# Name the node stage "builder"
FROM node:16 AS builder
# Set working directory
WORKDIR /app
# Copy all files from current directory to working dir in image
COPY . .
# install node modules and build assets
RUN npm i && npm run build
# STEP 2: EXPOSE 80
# nginx state for serving content
FROM nginx:alpine
# Set working directory to nginx asset directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static assets
RUN rm -rf ./*
# Copy static assets from builder stage
COPY --from=builder /app/dist/schedulord-frontend .
# Containers run nginx with global directives and daemon off
#ENTRY POINT ["nginx", "-g"] COPY dist /var/www
COPY config/nginx.conf /etc/nginx/nginx.conf
#ENTRYPOINT ["nginx", "-g", "daemon off;"]
EXPOSE 80

120
Jenkinsfile vendored
View File

@ -1,72 +1,68 @@
//pipeline {
// agent { dockerfile true }
// stages {
// stage('Test') {
// steps {
// echo "Build has worked!"
// }
// }
// }
//}
pipeline { pipeline {
agent none agent none
// tools {
// nodejs "815Node"
// }
// environment {
// registry = 'dockerhubusername/dockerhubusername'
// registryCredential = 'dockerhubcredentials'
// }
stages { stages {
stage('INSTALL PACKAGES') { stage('Fetch dependencies') {
agent any
steps {
sh "npm install"
}
}
stage('CODETEST') {
agent any
steps {
echo "insert your testing here"
}
}
stage('BUILD APP') {
agent any
steps {
sh "node_modules/.bin/ng build --prod"
}
}
stage('Angular frontend Karma Test') {
agent any
steps {
sh 'npm rebuild'
sh 'npm run test'
sh 'ng test'
}
}
stage("BUILD DOCKER") {
agent { agent {
dockerfile true docker 'circleci/node:9.3-stretch-browsers'
} }
steps { steps {
script { sh 'yarn'
dockerImageBuild = docker.build registry + ":latest" stash includes: 'node_modules/', name: 'node_modules'
} }
}
stage('Lint') {
agent {
docker 'circleci/node:9.3-stretch-browsers'
}
steps {
unstash 'node_modules'
sh 'yarn lint'
}
}
stage('Unit Test') {
agent {
docker 'circleci/node:9.3-stretch-browsers'
}
steps {
unstash 'node_modules'
sh 'yarn test:ci'
junit 'reports/**/*.xml'
}
}
stage('E2E Test') {
agent {
docker 'circleci/node:9.3-stretch-browsers'
}
steps {
unstash 'node_modules'
sh 'mkdir -p reports'
sh 'yarn e2e:pre-ci'
sh 'yarn e2e:ci'
sh 'yarn e2e:post-ci'
junit 'reports/**/*.xml'
}
}
stage('Compile') {
agent {
docker 'circleci/node:9.3-stretch-browsers'
}
steps {
unstash 'node_modules'
sh 'yarn build:prod'
stash includes: 'dist/', name: 'dist'
}
}
stage('Build and Push Docker Image') {
agent any
environment {
DOCKER_PUSH = credentials('docker_push')
}
steps {
unstash 'dist'
sh 'docker build -t $DOCKER_PUSH_URL/frontend .'
sh 'docker login -u $DOCKER_PUSH_USR -p $DOCKER_PUSH_PSW $DOCKER_PUSH_URL'
sh 'docker push $DOCKER_PUSH_URL/frontend'
} }
} }
// stage("DEPLOY DOCKER") {
// steps {
// script {
// docker.withRegistry('', registryCredential) {
// dockerImageBuild.push()
// }
// }
// }
// }
// stage("DEPLOY & ACTIVATE") {
// steps {
// echo 'this part will differ depending on setup'
// }
// }
} }
} }