Skip to content

Commit

Permalink
chore: nodev18 main --> develop (#2241)
Browse files Browse the repository at this point in the history
* chore: update node to v18.15.0

* chore: update node to v18.15.0

* fix: docker configuration files

* fix: docker configuration files and workflows

* fix: remove entry points in ut docker file

* feat: improvements to reduce build size and time

* refactor: improve build speed

* refactor: update .gitignore to the standard one

* chore: update production targets

* chore: fix package-lock.json

* chore: merge develop to feat branch

* chore: update package-lock.json to latest

* chore: upgrade all npm dependencies

* fix: syntax and lint issues

* fix: syntax and lint issues

* fix: removed optional chaining syntax

* chore: empty commit to trigger actions

* chore: omit dev dependencies in production builds

* chore: empty commit to trigger actions

* fix: build steps in dockerfile

* fix: build steps in ut dockerfile

* fix: formatting issues

* fix: formatting issues

* fix: isolated-vm package postinstall is not triggering issue

* chore: upgrade to latest node LTE version

* chore: override vulnerable packages (#2132)

* chore: override vulnerable packages

* chore: empty commit to trigger actions

---------

Co-authored-by: shrouti1507 <[email protected]>

* fix: copy prepare script file for dev target too

* chore: upgrade transformer cdk v1 to 1.4.6 (#2189)

Co-authored-by: Sai Sankeerth <[email protected]>

* chore: upgrade cdk to v1.4.9 (#2194)

* chore: push merged changes (#2218)

* chore: push merged changes

* fix: added koa-bodyparser as dev dependency

Signed-off-by: Sai Sankeerth <[email protected]>

---------

Signed-off-by: Sai Sankeerth <[email protected]>
Co-authored-by: Sai Sankeerth <[email protected]>

* fix: added missing build:ci script

Signed-off-by: Sai Sankeerth <[email protected]>

* fix: default parameters order, add types/node as dev dependency

* chore(release): 1.31.0

---------

Signed-off-by: Sai Sankeerth <[email protected]>
Co-authored-by: Yashasvi Bajpai <[email protected]>
Co-authored-by: saikumarrs <[email protected]>
Co-authored-by: Sai Kumar Battinoju <[email protected]>
Co-authored-by: shrouti1507 <[email protected]>
Co-authored-by: Sai Sankeerth <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: Sandeep Digumarty <[email protected]>
Co-authored-by: Krishna Chaitanya <[email protected]>
  • Loading branch information
9 people authored Jun 7, 2023
1 parent 52019ac commit 565462a
Show file tree
Hide file tree
Showing 20 changed files with 10,770 additions and 7,981 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
!package*.json
!tsconfig.json
!test
!scripts/skipPrepareScript.js
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ src/util/eventValidations.js
src/v0/destinations/personalize/scripts/
test/integrations/destinations/testTypes.d.ts
*.config*.js
scripts/skipPrepareScript.js
2 changes: 1 addition & 1 deletion .github/workflows/build-pr-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ jobs:
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ jobs:
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/prepare-for-staging-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
img_tag: ${{ needs.generate-tag-names.outputs.tag_name_ut }}
dockerfile: Dockerfile-ut-func
load_target: development
push_target: development
push_target: production
secrets:
DOCKERHUB_PROD_TOKEN: ${{ secrets.DOCKERHUB_PROD_TOKEN }}

Expand Down
136 changes: 131 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,134 @@
**/.DS_Store
.env
node_modules
npm-debug.log
reports/*
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov
reports

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Others
**/.DS_Store
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21.3
18.16.0
43 changes: 25 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# syntax=docker/dockerfile:1.4
FROM node:14.21.1-alpine3.15 AS base
FROM node:18.16.0-alpine3.17 AS base
ENV HUSKY 0

RUN apk update
RUN apk upgrade

# installing specific python version based on your previous configuration
RUN apk add --no-cache tini python2
# installing specific make version based on your previous configuration
RUN apk add make=4.2.1-r2 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.11/main
# installing specific gcc version based on your previous configuration
RUN apk add g++=9.3.0-r0 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.11/main
RUN apk add --no-cache tini make g++ python3

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app

FROM base AS development
ENV HUSKY 0

ARG version
ARG GIT_COMMIT_SHA
Expand All @@ -22,31 +19,39 @@ ENV git_commit_sha=$GIT_COMMIT_SHA

# Create app directory
WORKDIR /home/node/app
ADD . .
RUN chown -R node:node /home/node/app
USER node

RUN npm ci
RUN npm run build
COPY package*.json ./
COPY scripts/skipPrepareScript.js ./scripts/skipPrepareScript.js
RUN npm ci --no-audit --cache .npm
COPY --chown=node:node . .
RUN npm run build:ci -- --sourceMap false
RUN npm run copy

ENTRYPOINT ["/sbin/tini", "--"]

HEALTHCHECK --interval=1s --timeout=30s --retries=30 \
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1

CMD [ "npm", "start" ]

EXPOSE 9090/tcp

FROM base AS prodbuilder
FROM base AS prodDepsBuilder

WORKDIR /home/node/app
USER node
COPY --chown=node:node --from=development /home/node/app/package.json ./
COPY --chown=node:node --from=development /home/node/app/package*.json ./
COPY --chown=node:node --from=development /home/node/app/scripts/skipPrepareScript.js ./scripts/skipPrepareScript.js

RUN npm install --production
ENV SKIP_PREPARE_SCRIPT='true'

RUN npm ci --omit=dev --no-audit --cache .npm
RUN npm run clean:node

FROM base as production
ENV HUSKY 0

ARG version
ARG GIT_COMMIT_SHA
Expand All @@ -57,14 +62,16 @@ WORKDIR /home/node/app

USER node

COPY --chown=node:node --from=development /home/node/app/dist/ ./dist
COPY --chown=node:node --from=prodBuilder /home/node/app/package.json ./
COPY --chown=node:node --from=prodBuilder /home/node/app/node_modules ./node_modules
COPY --chown=node:node --from=prodDepsBuilder /home/node/app/package.json ./

COPY --chown=node:node --from=prodDepsBuilder /home/node/app/node_modules ./node_modules

COPY --chown=node:node --from=development /home/node/app/dist/ ./dist

ENTRYPOINT ["/sbin/tini", "--"]

HEALTHCHECK --interval=1s --timeout=30s --retries=30 \
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1

CMD [ "npm", "start" ]

Expand Down
55 changes: 48 additions & 7 deletions Dockerfile-ut-func
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# syntax=docker/dockerfile:1.4
FROM ubuntu:20.04 AS base
ENV HUSKY 0

RUN apt-get update \
&& apt-get install -y curl make g++ \
&& apt-get install -y cpio \
&& curl -sL https://deb.nodesource.com/setup_14.x | bash \
&& curl -sL https://deb.nodesource.com/setup_18.x | bash \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /var/lib/apt/lists.d/* \
Expand All @@ -17,25 +18,65 @@ RUN adduser --disabled-password --gecos "" --uid 1000 node
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app && mkdir -p /home/node/.npm && chown -R node:node /home/node/.npm

FROM base AS development
ENV HUSKY 0

ARG version
ARG GIT_COMMIT_SHA
ENV transformer_build_version=$version
ENV git_commit_sha=$GIT_COMMIT_SHA

# Create app directory
WORKDIR /home/node/app
RUN chown -R node:node /home/node/app
USER node
COPY --chown=node:node . .

COPY package*.json ./
COPY scripts/skipPrepareScript.js ./scripts/skipPrepareScript.js
RUN npm ci --no-audit --cache .npm
COPY --chown=node:node . .
RUN npm run build:ci -- --sourceMap false
RUN npm run copy

HEALTHCHECK --interval=1s --timeout=30s --retries=30 \
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1

CMD [ "npm", "start" ]

EXPOSE 9090/tcp

FROM base AS prodDepsBuilder

WORKDIR /home/node/app
USER node
COPY --chown=node:node --from=development /home/node/app/package*.json ./
COPY --chown=node:node --from=development /home/node/app/scripts/skipPrepareScript.js ./scripts/skipPrepareScript.js

ENV SKIP_PREPARE_SCRIPT='true'

RUN npm ci --omit=dev --no-audit --cache .npm
RUN npm run clean:node

FROM base as production
ENV HUSKY 0

ARG version
ARG GIT_COMMIT_SHA
ENV transformer_build_version=$version
ENV git_commit_sha=$GIT_COMMIT_SHA

WORKDIR /home/node/app

USER node

RUN npm ci
RUN npm run build
COPY --chown=node:node --from=prodDepsBuilder /home/node/app/package.json ./

COPY --chown=node:node --from=prodDepsBuilder /home/node/app/node_modules ./node_modules

COPY --chown=node:node --from=development /home/node/app/dist/ ./dist

HEALTHCHECK --interval=1s --timeout=30s --retries=30 \
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1
CMD wget --no-verbose --tries=5 --spider http://localhost:9090/health || exit 1

CMD [ "npm", "start" ]

EXPOSE 9090/tcp

# TODO: Add prod builds
Loading

0 comments on commit 565462a

Please sign in to comment.