Compare commits
2 Commits
da39a7fc5f
...
a78de2fbd5
Author | SHA1 | Date | |
---|---|---|---|
a78de2fbd5 | |||
d25b04d44a |
27
Dockerfile
27
Dockerfile
@ -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
|
||||
|
||||
#ENTRY POINT ["nginx", "-g"]
|
||||
|
||||
#ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||
EXPOSE 80
|
||||
|
||||
COPY dist /var/www
|
||||
COPY config/nginx.conf /etc/nginx/nginx.conf
|
||||
|
120
Jenkinsfile
vendored
120
Jenkinsfile
vendored
@ -1,72 +1,68 @@
|
||||
//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('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'
|
||||
}
|
||||
}
|
||||
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'
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user