Compare commits
No commits in common. "a78de2fbd55ceba2c3d42e154672903f0c55f3c8" and "da39a7fc5f0ee7617a8378c4c1f29d32a58e9c89" have entirely different histories.
a78de2fbd5
...
da39a7fc5f
27
Dockerfile
27
Dockerfile
@ -1,6 +1,25 @@
|
||||
FROM nginx:1.13.1-alpine
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
#ENTRY POINT ["nginx", "-g"]
|
||||
|
||||
#ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||
EXPOSE 80
|
||||
|
||||
COPY dist /var/www
|
||||
COPY config/nginx.conf /etc/nginx/nginx.conf
|
||||
|
122
Jenkinsfile
vendored
122
Jenkinsfile
vendored
@ -1,68 +1,72 @@
|
||||
//pipeline {
|
||||
// agent { dockerfile true }
|
||||
// stages {
|
||||
// stage('Test') {
|
||||
// steps {
|
||||
// echo "Build has worked!"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
pipeline {
|
||||
agent none
|
||||
// tools {
|
||||
// nodejs "815Node"
|
||||
// }
|
||||
// environment {
|
||||
// registry = 'dockerhubusername/dockerhubusername'
|
||||
// registryCredential = 'dockerhubcredentials'
|
||||
// }
|
||||
stages {
|
||||
stage('Fetch dependencies') {
|
||||
agent {
|
||||
docker 'circleci/node:9.3-stretch-browsers'
|
||||
}
|
||||
steps {
|
||||
sh 'yarn'
|
||||
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') {
|
||||
stage('INSTALL PACKAGES') {
|
||||
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'
|
||||
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 {
|
||||
dockerfile true
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
dockerImageBuild = docker.build registry + ":latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
// stage("DEPLOY DOCKER") {
|
||||
// steps {
|
||||
// script {
|
||||
// docker.withRegistry('', registryCredential) {
|
||||
// dockerImageBuild.push()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// stage("DEPLOY & ACTIVATE") {
|
||||
// steps {
|
||||
// echo 'this part will differ depending on setup'
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user