From 7a326f7dc8a1e382985ab773bdc3a60a1c592926 Mon Sep 17 00:00:00 2001 From: akshay Date: Wed, 1 Mar 2023 14:15:30 +0530 Subject: [PATCH] chg: cleanup notification service --- notifications/Dockerfile | 58 +++----- .../config/constant/notificationConstants.js | 9 +- .../app/config/environments/base/env.cors.js | 11 -- .../app/config/environments/base/env.db.js | 8 -- .../app/config/environments/base/index.js | 3 - notifications/app/init/database.init.js | 11 -- .../app/lib/mailer/emails/sign-up/html.pug | 64 ++++----- .../app/lib/mailer/emails/sign-up/index.js | 1 + .../app/lib/mailer/emails/sign-up/subject.pug | 2 +- notifications/app/lib/utils/s3Utils.js | 125 ------------------ .../lib/config/development_env_config.json | 9 +- seller/Dockerfile | 58 +++----- 12 files changed, 76 insertions(+), 283 deletions(-) delete mode 100644 notifications/app/config/environments/base/env.db.js delete mode 100644 notifications/app/lib/utils/s3Utils.js diff --git a/notifications/Dockerfile b/notifications/Dockerfile index c897bc2..3f3046c 100644 --- a/notifications/Dockerfile +++ b/notifications/Dockerfile @@ -1,40 +1,26 @@ -# Node module installation stage -FROM node:16.14.0 AS npmPackageInstallationStage -WORKDIR /usr/src/app-staging-folder -COPY package*.json ./ +FROM node:16.14.0 + +# Set the working directory to /usr/src/app +WORKDIR /usr/src/app + +#Need to copy utils as well + +RUN npm cache verify + +COPY . . -# Note: all npm packages are installed directly in the workdir and not under node_modules. RUN npm install +# Copy the current directory contents into the container at /usr/src/app COPY . . -# Babel build creation stage -FROM node:16.14.0 AS distCreationStage -WORKDIR /usr/src/app-staging-folder -RUN mkdir node_modules - -# Copy node_modules from npmPackageInstallationStage -COPY --chown=node:node --from=npmPackageInstallationStage /usr/src/app-staging-folder/* /usr/src/app-staging-folder/node_modules/ - -# Copy code base for babel compilation -COPY package*.json ./ -COPY ./app ./app - -ENV NODE_ENV production -ENV APP_ENV production -RUN pwd -RUN ls -alrt -RUN npm run babelBuild - -# Production docker image creation stage -FROM node:16.14.0 AS dockerImageCreationStage -RUN apt update -RUN apt-get install -y dumb-init - -ENV NODE_ENV production -ENV APP_ENV production - -USER node -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/node_modules /usr/src/app-staging-folder/node_modules/ -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/package.json /usr/src/app-staging-folder/package.json -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/dist /usr/src/app-staging-folder/dist -CMD ["dumb-init", "node", "./dist/bin/www"] \ No newline at end of file +#RUN npm run build + +#ENV NODE_ENV production +#ENV APP_ENV production +ENV HOST 0.0.0.0 +ENV PROTOCOL "http://" +ENV USE_FQDN_FOR_APIS false +ENV FQDN "" + +#CMD [ "npm", "serve", "--port", $PORT] +CMD exec npm run start diff --git a/notifications/app/config/constant/notificationConstants.js b/notifications/app/config/constant/notificationConstants.js index 03c1d39..7103c09 100644 --- a/notifications/app/config/constant/notificationConstants.js +++ b/notifications/app/config/constant/notificationConstants.js @@ -1,10 +1,3 @@ module.exports = Object.freeze({ - MOM_MENTION: 'MOM_MENTION', - TASK_ASSIGN: 'TASK_ASSIGN', - PROJECT_ASSIGN: 'PROJECT_ASSIGN', - COMMENT_MENTION: 'COMMENT_MENTION', - NEW_COMMENT: 'NEW_COMMENT', - TEAM_ASSIGN: 'TEAM_ASSIGN', - TASK_APPROVE_SUCCESS: 'TASK_APPROVE_SUCCESS', - TASK_APPROVE_FAIL: 'TASK_APPROVE_FAIL', + }); diff --git a/notifications/app/config/environments/base/env.cors.js b/notifications/app/config/environments/base/env.cors.js index 178caca..08b07ea 100644 --- a/notifications/app/config/environments/base/env.cors.js +++ b/notifications/app/config/environments/base/env.cors.js @@ -4,17 +4,6 @@ module.exports = { '*', 'http://localhost:3000', 'https://localhost:3000', - 'https://artifex.com', - 'http://artifex.com', - 'https://staging.artifex.com', - 'http://staging.artifex.com', - 'http://dev.artifex.com', - 'https://dev.artifex.com', - 'https://artifex-auth-dev.wemotive.in', - 'https://artifex-pm-dev.wemotive.in', - 'https://artifex.artifex-dev.com:3000', - 'https://auth.artifex-dev.com:3005' - ] } }; diff --git a/notifications/app/config/environments/base/env.db.js b/notifications/app/config/environments/base/env.db.js deleted file mode 100644 index dae3e25..0000000 --- a/notifications/app/config/environments/base/env.db.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - mongodb: { - username: process.env.MONGODB_DATABASE_USERNAME, - password: process.env.MONGODB_DATABASE_PASSWORD, - name: process.env.MONGODB_DATABASE_NAME, - host: process.env.MONGODB_DATABASE_HOST, - } -}; diff --git a/notifications/app/config/environments/base/index.js b/notifications/app/config/environments/base/index.js index 327abd6..d22f2e2 100644 --- a/notifications/app/config/environments/base/index.js +++ b/notifications/app/config/environments/base/index.js @@ -1,13 +1,10 @@ import baseConfig from './env.base'; import corsConfig from './env.cors'; -import dbConfig from './env.db'; const mailConfig = require('./env.email'); - const mergedEnvironmentConfig = { ...baseConfig, ...corsConfig, - ...dbConfig, ...mailConfig }; diff --git a/notifications/app/init/database.init.js b/notifications/app/init/database.init.js index 6972add..e69de29 100644 --- a/notifications/app/init/database.init.js +++ b/notifications/app/init/database.init.js @@ -1,11 +0,0 @@ -import mongoose from 'mongoose'; -import { mergedEnvironmentConfig } from '../config/env.config.js'; - -const config = mergedEnvironmentConfig.mongodb; -mongoose.connect(`${config.host}/${config.name}`,{ - useNewUrlParser:true -}); - -mongoose.set('debug', (collectionName, method, query, doc) => { - console.log(`[MONGOOS]:${collectionName}.${method}`, JSON.stringify(query), doc); -}); diff --git a/notifications/app/lib/mailer/emails/sign-up/html.pug b/notifications/app/lib/mailer/emails/sign-up/html.pug index cef2a13..e18cf3e 100644 --- a/notifications/app/lib/mailer/emails/sign-up/html.pug +++ b/notifications/app/lib/mailer/emails/sign-up/html.pug @@ -19,32 +19,32 @@ head o:pixelsperinch 96 style(type='text/css'). #outlook a { - padding:0; + padding:0; } .es-button { - mso-style-priority:100!important; - text-decoration:none!important; + mso-style-priority:100!important; + text-decoration:none!important; } a[x-apple-data-detectors] { - color:inherit!important; - text-decoration:none!important; - font-size:inherit!important; - font-family:inherit!important; - font-weight:inherit!important; - line-height:inherit!important; + color:inherit!important; + text-decoration:none!important; + font-size:inherit!important; + font-family:inherit!important; + font-weight:inherit!important; + line-height:inherit!important; } .es-desk-hidden { - display:none; - float:left; - overflow:hidden; - width:0; - max-height:0; - line-height:0; - mso-hide:all; + display:none; + float:left; + overflow:hidden; + width:0; + max-height:0; + line-height:0; + mso-hide:all; } [data-ogsb] .es-button { - border-width:0!important; - padding:10px 30px 10px 30px!important; + border-width:0!important; + padding:10px 30px 10px 30px!important; } @media only screen and (max-width:600px) {p, ul li, ol li, a { line-height:150%!important } h1, h2, h3, h1 a, h2 a, h3 a { line-height:120%!important } h1 { font-size:36px!important; text-align:left } h2 { font-size:26px!important; text-align:left } h3 { font-size:20px!important; text-align:left } .es-header-body h1 a, .es-content-body h1 a, .es-footer-body h1 a { font-size:36px!important; text-align:left } .es-header-body h2 a, .es-content-body h2 a, .es-footer-body h2 a { font-size:26px!important; text-align:left } .es-header-body h3 a, .es-content-body h3 a, .es-footer-body h3 a { font-size:20px!important; text-align:left } .es-menu td a { font-size:12px!important } .es-header-body p, .es-header-body ul li, .es-header-body ol li, .es-header-body a { font-size:14px!important } .es-content-body p, .es-content-body ul li, .es-content-body ol li, .es-content-body a { font-size:14px!important } .es-footer-body p, .es-footer-body ul li, .es-footer-body ol li, .es-footer-body a { font-size:14px!important } .es-infoblock p, .es-infoblock ul li, .es-infoblock ol li, .es-infoblock a { font-size:12px!important } *[class="gmail-fix"] { display:none!important } .es-m-txt-c, .es-m-txt-c h1, .es-m-txt-c h2, .es-m-txt-c h3 { text-align:center!important } .es-m-txt-r, .es-m-txt-r h1, .es-m-txt-r h2, .es-m-txt-r h3 { text-align:right!important } .es-m-txt-l, .es-m-txt-l h1, .es-m-txt-l h2, .es-m-txt-l h3 { text-align:left!important } .es-m-txt-r img, .es-m-txt-c img, .es-m-txt-l img { display:inline!important } .es-button-border { display:inline-block!important } a.es-button, button.es-button { font-size:20px!important; display:inline-block!important } .es-adaptive table, .es-left, .es-right { width:100%!important } .es-content table, .es-header table, .es-footer table, .es-content, .es-footer, .es-header { width:100%!important; max-width:600px!important } .es-adapt-td { display:block!important; width:100%!important } .adapt-img { width:100%!important; height:auto!important } .es-m-p0 { padding:0!important } .es-m-p0r { padding-right:0!important } .es-m-p0l { padding-left:0!important } .es-m-p0t { padding-top:0!important } .es-m-p0b { padding-bottom:0!important } .es-m-p20b { padding-bottom:20px!important } .es-mobile-hidden, .es-hidden { display:none!important } tr.es-desk-hidden, td.es-desk-hidden, table.es-desk-hidden { width:auto!important; overflow:visible!important; float:none!important; max-height:inherit!important; line-height:inherit!important } tr.es-desk-hidden { display:table-row!important } table.es-desk-hidden { display:table!important } td.es-desk-menu-hidden { display:table-cell!important } .es-menu td { width:1%!important } table.es-table-not-adapt, .esd-block-html table { width:auto!important } table.es-social { display:inline-block!important } table.es-social td { display:inline-block!important } .es-m-p5 { padding:5px!important } .es-m-p5t { padding-top:5px!important } .es-m-p5b { padding-bottom:5px!important } .es-m-p5r { padding-right:5px!important } .es-m-p5l { padding-left:5px!important } .es-m-p10 { padding:10px!important } .es-m-p10t { padding-top:10px!important } .es-m-p10b { padding-bottom:10px!important } .es-m-p10r { padding-right:10px!important } .es-m-p10l { padding-left:10px!important } .es-m-p15 { padding:15px!important } .es-m-p15t { padding-top:15px!important } .es-m-p15b { padding-bottom:15px!important } .es-m-p15r { padding-right:15px!important } .es-m-p15l { padding-left:15px!important } .es-m-p20 { padding:20px!important } .es-m-p20t { padding-top:20px!important } .es-m-p20r { padding-right:20px!important } .es-m-p20l { padding-left:20px!important } .es-m-p25 { padding:25px!important } .es-m-p25t { padding-top:25px!important } .es-m-p25b { padding-bottom:25px!important } .es-m-p25r { padding-right:25px!important } .es-m-p25l { padding-left:25px!important } .es-m-p30 { padding:30px!important } .es-m-p30t { padding-top:30px!important } .es-m-p30b { padding-bottom:30px!important } .es-m-p30r { padding-right:30px!important } .es-m-p30l { padding-left:30px!important } .es-m-p35 { padding:35px!important } .es-m-p35t { padding-top:35px!important } .es-m-p35b { padding-bottom:35px!important } .es-m-p35r { padding-right:35px!important } .es-m-p35l { padding-left:35px!important } .es-m-p40 { padding:40px!important } .es-m-p40t { padding-top:40px!important } .es-m-p40b { padding-bottom:40px!important } .es-m-p40r { padding-right:40px!important } .es-m-p40l { padding-left:40px!important } } .es-wrapper-color(style='background-color:#FAFAFA') @@ -63,10 +63,6 @@ head table(cellpadding='0' cellspacing='0' width='100%' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') tr td.es-m-p0r(valign='top' align='center' style='padding:0;Margin:0;width:560px') - table(cellpadding='0' cellspacing='0' width='100%' role='presentation' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') - tr - td(align='center' style='padding:0;Margin:0;padding-bottom:20px;font-size:0px') - img(src='https://umiopo.stripocdn.email/content/guids/CABINET_2b907483313026d011fe1fd327aed97b/images/viasimplex.png' alt='Logo' style='display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic;font-size:12px' width='70' title='Logo' height='69') table.es-content(cellpadding='0' cellspacing='0' align='center' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%') tr td(align='center' style='padding:0;Margin:0') @@ -79,7 +75,7 @@ head table(cellpadding='0' cellspacing='0' width='100%' role='presentation' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') tr td(align='center' style='padding:0;Margin:0;padding-top:10px;padding-bottom:10px;font-size:0px') - img(src='https://umiopo.stripocdn.email/content/guids/CABINET_9ca3362f6e3ce2c3ea60da8fe4f8a850/images/78491618321704551.png' alt='' style='display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic' width='150' height='150') + img(src='https://edu-static-files.s3.us-east-2.amazonaws.com/forgot+password' alt='' style='display:block;border:0;outline:none;text-decoration:none;-ms-interpolation-mode:bicubic' width='150' height='150') table.es-content(cellpadding='0' cellspacing='0' align='center' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%') tr td(align='center' style='padding:0;Margin:0') @@ -97,28 +93,18 @@ head br br p(style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:17px;color:#333333;font-size:14px") - | Welcome to Artifex! Your account is almost ready! + | Welcome to ONDC seller app, please use below OTP to login. br br p(style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:17px;color:#333333;font-size:14px") - | As a next step, please login at the link below using the temporary password #{temporaryPassword}. + | OTP   #{ password } br br - | - a(href=appLoginUrl target='_blank' style='-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;text-decoration:underline;color:#00AFEF;font-size:18px') #{appLoginUrl} + p(style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:17px;color:#333333;font-size:14px") + | We recommend that you log in and change your password. br br - table.es-content(cellpadding='0' cellspacing='0' align='center' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%') - tr - td(align='center' style='padding:0;Margin:0') - table.es-content-body(bgcolor='#ffffff' align='center' cellpadding='0' cellspacing='0' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;background-color:#FFFFFF;width:600px') - tr - td(align='left' style='padding:0;Margin:0;padding-top:20px;padding-left:20px;padding-right:20px') - table(cellpadding='0' cellspacing='0' width='100%' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') - tr - td(align='center' valign='top' style='padding:0;Margin:0;width:560px') - table(cellpadding='0' cellspacing='0' width='100%' role='presentation' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') - tr + table.es-footer(cellpadding='0' cellspacing='0' align='center' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px;table-layout:fixed !important;width:100%;background-color:transparent;background-repeat:repeat;background-position:center top') tr td(align='center' style='padding:0;Margin:0') @@ -131,4 +117,4 @@ head table(cellpadding='0' cellspacing='0' width='100%' role='presentation' style='mso-table-lspace:0pt;mso-table-rspace:0pt;border-collapse:collapse;border-spacing:0px') tr td(align='center' style='padding:0;Margin:0;padding-bottom:35px') - p(style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:18px;color:#333333;font-size:12px") 401, S No 30, Saraswati Ranta, Near Shashitara Vihar, Hingane Khurd, Pune Maharashtra 411051 + p(style="Margin:0;-webkit-text-size-adjust:none;-ms-text-size-adjust:none;mso-line-height-rule:exactly;font-family:arial, 'helvetica neue', helvetica, sans-serif;line-height:18px;color:#333333;font-size:12px") diff --git a/notifications/app/lib/mailer/emails/sign-up/index.js b/notifications/app/lib/mailer/emails/sign-up/index.js index 6193b09..a1013ab 100644 --- a/notifications/app/lib/mailer/emails/sign-up/index.js +++ b/notifications/app/lib/mailer/emails/sign-up/index.js @@ -26,6 +26,7 @@ class SignUp extends Email { name = `${user.firstName} ${user.lastName}`; return { temporaryPassword, + password:temporaryPassword, name: name, logo, appLoginUrl, diff --git a/notifications/app/lib/mailer/emails/sign-up/subject.pug b/notifications/app/lib/mailer/emails/sign-up/subject.pug index 95f5e46..cb41299 100644 --- a/notifications/app/lib/mailer/emails/sign-up/subject.pug +++ b/notifications/app/lib/mailer/emails/sign-up/subject.pug @@ -1 +1 @@ -= `Invitation to ARTIFEX from ${organization}` \ No newline at end of file += `Invitation to ONDC Seller APP` \ No newline at end of file diff --git a/notifications/app/lib/utils/s3Utils.js b/notifications/app/lib/utils/s3Utils.js deleted file mode 100644 index 641c72a..0000000 --- a/notifications/app/lib/utils/s3Utils.js +++ /dev/null @@ -1,125 +0,0 @@ -import AWS from 'aws-sdk'; -import { v4 as uuidv4 } from 'uuid'; -import config from '../lib/config'; - -const accessKeyId = config.get('s3').accessKeyId; -const secretAccessKey = config.get('s3').secretAccessKey; -const version = config.get('s3').version; -const region = config.get('s3').region; -const bucket = config.get('s3').bucket; - -//TODO:move to ext config -const s3 = new AWS.S3({ - accessKeyId: accessKeyId, - secretAccessKey: secretAccessKey, - useAccelerateEndpoint: true, - signatureVersion: version, - region: region -}); - -const publicConfig = config.get('s3Public'); -const s3Public = new AWS.S3({ - accessKeyId: accessKeyId, - secretAccessKey: secretAccessKey, - useAccelerateEndpoint: false, - signatureVersion: version, - region: region -}); -const signedUrlExpireSeconds = 60 * 60; - -const myBucket = bucket; - -const getSignedUrlForUpload = (s3,myBucket) => async(data) => { - - //TODO: Use Axios to send http request - try { - const myKey = data.path + '/' + uuidv4() + data.fileType.replace(/^\.?/, '.'); - const params = { - Bucket: myBucket, - Key: myKey, - Expires: signedUrlExpireSeconds - }; - return await new Promise( - (resolve, reject) => s3.getSignedUrl('putObject', params, function (err, url) { - if (err) { - console.log('Error getting presigned url from AWS S3', err); - reject({success: false, message: 'Pre-Signed URL error', urls: url}); - } else { - resolve({ - success: true, - message: 'AWS SDK S3 Pre-signed urls generated successfully.', - path: myKey, - urls: url - }); - } - })); - } catch (err) { - return err; - } -}; - -exports.getSignedUrlForUpload = getSignedUrlForUpload(s3,myBucket); -exports.getSignedUrlForUploadPublic = getSignedUrlForUpload(s3Public,publicConfig.bucket); - -exports.getSignedUrlForRead = async(data) => { - //TODO: Use Axios to send http request - try { - let myKey = data.path; - let trimValue = 'https://api-images-prod.s3.amazonaws.com/'; - if (myKey) { - myKey = myKey.replace(trimValue,''); - } - const params = { - Bucket: myBucket, - Key: myKey, - Expires: signedUrlExpireSeconds - }; - return await new Promise( - (resolve, reject) => s3.getSignedUrl('getObject', params, function (err, url) { - if (err) { - // console.log('Error getting presigned url from AWS S3'); - reject({success: false, message: 'Pre-Signed URL erro', urls: url}); - } else { - // console.log('Presigned URL: ', url); - resolve({ url: url, path: data.path }); - } - })); - } catch (err) { - return err; - } -}; - -exports.getFileAsStream = async(data) => { - //TODO: Use Axios to send http request - // promisify read stream from s3 - function getBufferFromS3Promise(file) { - return new Promise((resolve, reject) => { - getBufferFromS3(file, (error, s3buffer) => { - if (error) return reject(error); - return resolve(s3buffer); - }); - }); - } - - // Get buffered file from s3 - function getBufferFromS3(file, callback) { - let myKey = file; - const buffers = []; - var options = { - Bucket: myBucket, - Key: myKey, - }; - const stream = s3.getObject(options).createReadStream(); - stream.on('data', data => buffers.push(data)); - stream.on('end', () => callback(null, Buffer.concat(buffers))); - stream.on('error', error => callback(error)); - } - try { - const myKey = data.path; - const buffer = await getBufferFromS3Promise(myKey); - return buffer; - } catch (err) { - return err; - } -}; - diff --git a/seller-app-api/lib/config/development_env_config.json b/seller-app-api/lib/config/development_env_config.json index ab58195..e34b205 100644 --- a/seller-app-api/lib/config/development_env_config.json +++ b/seller-app-api/lib/config/development_env_config.json @@ -75,18 +75,17 @@ "akshay@wemotiveforge.com" ] }, - "strapi": { - "serverUrl": "http://localhost:1337", - "apiToken": "1465d1ca50726c39d0a764ba345121bc594f4923367de7d8ce57c779c0b3a3fd64eecbd4268e5e8818a57068f0f48b1b7d3a4ec20cfeb55e48bf902283c318b8b9fbe7f6fd9e86e813eab18acbd38075a2389bd5e5eb73fe1ba9607d3f9e7b00a5cc46c8dcf617734f52ec0e91b90d167a180bba4ed1f0a7d7ad026f28c5aad2" + "seller": { + "serverUrl": "http://localhost:3019" }, "firebase": { "account": "lib/config/firebase-service-account.json" }, "sellerConfig": { "BPP_ID": "sellerapp-staging.datasyndicate.in", - "BPP_URI": "https://8d61-103-115-202-153.in.ngrok.io", + "BPP_URI": "https://6607-2402-e280-3e33-24e-7533-b3a7-881b-4166.in.ngrok.io", "BAP_ID": "sellerapp-staging.datasyndicate.in", - "BAP_URI": "https://8d61-103-115-202-153.in.ngrok.io", + "BAP_URI": "https://6607-2402-e280-3e33-24e-7533-b3a7-881b-4166.in.ngrok.io", "storeOpenSchedule": { "time": { "days": "1,2,3,4,5,6,7", diff --git a/seller/Dockerfile b/seller/Dockerfile index c897bc2..3f3046c 100644 --- a/seller/Dockerfile +++ b/seller/Dockerfile @@ -1,40 +1,26 @@ -# Node module installation stage -FROM node:16.14.0 AS npmPackageInstallationStage -WORKDIR /usr/src/app-staging-folder -COPY package*.json ./ +FROM node:16.14.0 + +# Set the working directory to /usr/src/app +WORKDIR /usr/src/app + +#Need to copy utils as well + +RUN npm cache verify + +COPY . . -# Note: all npm packages are installed directly in the workdir and not under node_modules. RUN npm install +# Copy the current directory contents into the container at /usr/src/app COPY . . -# Babel build creation stage -FROM node:16.14.0 AS distCreationStage -WORKDIR /usr/src/app-staging-folder -RUN mkdir node_modules - -# Copy node_modules from npmPackageInstallationStage -COPY --chown=node:node --from=npmPackageInstallationStage /usr/src/app-staging-folder/* /usr/src/app-staging-folder/node_modules/ - -# Copy code base for babel compilation -COPY package*.json ./ -COPY ./app ./app - -ENV NODE_ENV production -ENV APP_ENV production -RUN pwd -RUN ls -alrt -RUN npm run babelBuild - -# Production docker image creation stage -FROM node:16.14.0 AS dockerImageCreationStage -RUN apt update -RUN apt-get install -y dumb-init - -ENV NODE_ENV production -ENV APP_ENV production - -USER node -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/node_modules /usr/src/app-staging-folder/node_modules/ -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/package.json /usr/src/app-staging-folder/package.json -COPY --chown=node:node --from=distCreationStage /usr/src/app-staging-folder/dist /usr/src/app-staging-folder/dist -CMD ["dumb-init", "node", "./dist/bin/www"] \ No newline at end of file +#RUN npm run build + +#ENV NODE_ENV production +#ENV APP_ENV production +ENV HOST 0.0.0.0 +ENV PROTOCOL "http://" +ENV USE_FQDN_FOR_APIS false +ENV FQDN "" + +#CMD [ "npm", "serve", "--port", $PORT] +CMD exec npm run start