diff --git a/Dockerfile b/Dockerfile index af4c4d3..9bfde68 100644 --- a/Dockerfile +++ b/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 +EXPOSE 80 -#ENTRY POINT ["nginx", "-g"] - -#ENTRYPOINT ["nginx", "-g", "daemon off;"] -EXPOSE 80 \ No newline at end of file +COPY dist /var/www +COPY config/nginx.conf /etc/nginx/nginx.conf diff --git a/Jenkinsfile b/Jenkinsfile index 459a82e..ebbffea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,10 +1,32 @@ pipeline { - agent { dockerfile true } - stages { - stage('Test') { - steps { - echo "Build has worked!" - } - } + agent any + tools { + nodejs "node" + } + stages { + stage('NPM Install') { + steps { + sh 'npm install' + } } -} \ No newline at end of file + +// stage('Test') { +// steps { +// sh 'npm run ng test --progress=false --watch false' +// junit '**/test-results.xml' +// } +// } + + stage('Lint') { + steps { + sh 'npm run ng lint' + } + } + + stage('Build') { + steps { + sh 'npm run ng build --prod --aot --sm --progress=false' + } + } + } +} diff --git a/karma.conf.js b/karma.conf.js index c78df70..812ae38 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -37,8 +37,43 @@ module.exports = function (config) { colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); +// browsers: ['Chrome'], +// singleRun: false, +// Start custom code +browsers:[ + "ChromeHeadlessNoSandbox" +], +customLaunchers:{ + ChromeHeadlessNoSandbox:{ + base:"ChromeHeadless", + flags:[ + "--no-sandbox", + // required to run without privileges in Docker + "--disable-web-security", + "--disable-gpu", + "--remote-debugging-port=9222" + ] + } +}, +singleRun:false, +junitReporter:{ + outputDir:'test-reports', + // results will be saved as $outputDir/$browserName.xml + outputFile:'junit-report.xml', + // if included, results will be saved as $outputDir/$browserName/$outputFile + suite:'', + // suite will become the package name attribute in xml testsuite element + useBrowserName:false, + // add browser name to report and classes names + nameFormatter:undefined, + // function (browser, result) to customize the name attribute in xml testcase element + classNameFormatter:undefined, + // function (browser, result) to customize the classname attribute in xml testcase element + properties:{ + } // key value pair of properties to add to the section of the report +} +}); +//end Custom Code +// restartOnFileChange: true +// }); };