updated
gitea_dndsources/schedulord-frontend/pipeline/head There was a failure building this commit Details

This commit is contained in:
Jesse James Isler 2022-06-09 10:20:46 +02:00
parent d25b04d44a
commit a78de2fbd5
2 changed files with 58 additions and 99 deletions

View File

@ -1,25 +1,6 @@
# STEP 1:
# 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
FROM nginx:1.13.1-alpine
# STEP 2:
# 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
EXPOSE 80
#ENTRY POINT ["nginx", "-g"]
#ENTRYPOINT ["nginx", "-g", "daemon off;"]
EXPOSE 80
COPY dist /var/www
COPY config/nginx.conf /etc/nginx/nginx.conf

130
Jenkinsfile vendored
View File

@ -1,89 +1,67 @@
/*
//Original Pipeline
pipeline {
agent { dockerfile true }
stages {
stage('Test') {
steps {
echo "Build has worked!"
}
}
}
}
*/
//New Pipeline
pipeline {
agent none
/*
//For some reason, this scrashes Jenkins
tools {
nodejs "815Node"
}
*/
/* We won't be Pushing to Dockerhub YET
environment {
registry = 'dockerhubusername/dockerhubusername'
registryCredential = 'dockerhubcredentials'
}
*/
stages {
stage('INSTALL PACKAGES') {
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") {
stage('Fetch dependencies') {
agent {
dockerfile true
docker 'circleci/node:9.3-stretch-browsers'
}
steps {
script {
dockerImageBuild = docker.build registry + ":latest"
}
sh 'yarn'
stash includes: 'node_modules/', name: 'node_modules'
}
}
/*
// Again, no pushing to Docker Hub
stage("DEPLOY DOCKER") {
steps {
script {
docker.withRegistry('', registryCredential) {
dockerImageBuild.push()
}
}
stage('Lint') {
agent {
docker 'circleci/node:9.3-stretch-browsers'
}
}
stage("DEPLOY & ACTIVATE") {
steps {
echo 'this part will differ depending on setup'
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'
}
}
}