Skip to content

Commit

Permalink
fix: deployment optimization (#706)
Browse files Browse the repository at this point in the history
* fix: deployment optimization

Signed-off-by: Carina Ursu <[email protected]>

* clean up node modules and one file that we think is not needed

Signed-off-by: Yee Hing Tong <[email protected]>

---------

Signed-off-by: Carina Ursu <[email protected]>
Signed-off-by: Yee Hing Tong <[email protected]>
Co-authored-by: Yee Hing Tong <[email protected]>
  • Loading branch information
ursucarina and wild-endeavor authored Mar 6, 2023
1 parent c075f4f commit 154e5ed
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 157 deletions.
16 changes: 11 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# syntax=docker/dockerfile:experimental
FROM node:16 as builder

# Use node:17 to docker build on M1
FROM --platform=${BUILDPLATFORM} node:16 as builder
LABEL org.opencontainers.image.source https://github.com/flyteorg/flyteconsole

ARG TARGETARCH
ENV npm_config_target_arch "${TARGETARCH}"
ENV npm_config_target_platform linux
ENV npm_config_target_libc glibc

WORKDIR /my-project/
COPY . /my-project/

RUN : \
--mount=type=cache,target=/root/.yarn \
# install production dependencies
Expand All @@ -15,15 +19,17 @@ RUN : \
&& rm -rf node_modules/@flyteorg \
&& cp -R node_modules /app

WORKDIR /my-project/
RUN : \
--mount=type=cache,target=/root/.yarn \
# install all dependencies so we can build
&& yarn workspaces focus --all --production \
&& yarn build:pack \
&& yarn build:types \
&& BASE_URL=/console yarn run build:prod \
&& cp -R ./website/dist/* /app

RUN rm -rf /app/node_modules
RUN rm -f /app/client-stats.json

FROM gcr.io/distroless/nodejs
LABEL org.opencontainers.image.source https://github.com/flyteorg/flyteconsole

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"postinstall": "husky install",
"build:pack": "yarn workspaces foreach -vit --include '{@flyteorg/flyteidl-types,@flyteorg/flyte-api,@flyteorg/ui-atoms,@flyteorg/common,@flyteorg/locale,@flyteorg/flyte-api,@flyteorg/components,@flyteorg/console}' run build",
"build:types": "yarn workspaces foreach -vit --include '{@flyteorg/flyteidl-types,@flyteorg/flyte-api,@flyteorg/ui-atoms,@flyteorg/common,@flyteorg/locale,@flyteorg/flyte-api,@flyteorg/components,@flyteorg/console}' run build:types",
"clean": "git clean -fxd --exclude script",
"gen:ssl": "make generate_ssl",
"start": "yarn workspace @flyteconsole/client-app start",
Expand Down
1 change: 1 addition & 0 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
}
}
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
},
"dependencies": {
Expand Down
5 changes: 3 additions & 2 deletions packages/console/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyteorg/console",
"version": "0.0.11",
"version": "0.0.10",
"description": "Flyteconsole main app module",
"main": "./dist/index.js",
"module": "./lib/index.js",
Expand Down Expand Up @@ -33,8 +33,9 @@
"clean": "rm -rf dist && rm -rf lib && rm -rf **.tsbuildinfo || true",
"build:watch": "run -T tsc-watch --noClear -p ./tsconfig.es.build.json --onSuccess \"yarn build\"",
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "mkdir lib && cp -R src/assets ./lib && run -T tsc --module esnext --outDir ./lib --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:esm": "mkdir lib && cp -R src/assets ./lib && run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "mkdir dist && cp -R src/assets ./dist && run -T wait-on ./dist/assets && run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
},
"installConfig": {
Expand Down
1 change: 1 addition & 0 deletions packages/flyte-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"push:update": "yarn clean && yarn build && yarn publish",
"test": "NODE_ENV=test jest"
},
Expand Down
1 change: 1 addition & 0 deletions packages/flyteidl-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
},
"peerDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/locale/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/ui-atoms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"build": "yarn clean && yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.build.es.json && run -T tsc-alias -p ./tsconfig.build.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:types": "run -T tsc --module esnext --project ./tsconfig.build.es.json --emitDeclarationOnly && run -T tsc-alias -p ./tsconfig.build.es.json",
"test": "NODE_ENV=test jest"
},
"installConfig": {
Expand Down
2 changes: 1 addition & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"@flyteorg/common": "^0.0.3",
"@flyteorg/console": "^0.0.7",
"@flyteorg/console": "^0.0.10",
"long": "^4.0.0",
"protobufjs": "~6.11.3",
"react-ga4": "^1.4.1",
Expand Down
158 changes: 9 additions & 149 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ __metadata:
resolution: "@flyteconsole/client-app@workspace:website"
dependencies:
"@flyteorg/common": ^0.0.3
"@flyteorg/console": ^0.0.7
"@flyteorg/console": ^0.0.10
"@types/long": ^3.0.32
long: ^4.0.0
protobufjs: ~6.11.3
Expand Down Expand Up @@ -2034,77 +2034,7 @@ __metadata:
languageName: unknown
linkType: soft

"@flyteorg/console@npm:^0.0.7":
version: 0.0.7
resolution: "@flyteorg/console@npm:0.0.7"
dependencies:
"@date-io/moment": 1.3.9
"@emotion/core": 10.1.1
"@flyteorg/common": ^0.0.3
"@flyteorg/components": ^0.0.3
"@flyteorg/flyte-api": ^0.0.2
"@flyteorg/flyteidl-types": ^0.0.3
"@flyteorg/locale": ^0.0.2
"@flyteorg/ui-atoms": ^0.0.3
"@material-ui/core": ^4.12.4
"@material-ui/icons": ^4.11.3
"@material-ui/pickers": ^3.2.2
"@rjsf/core": 3.2.1
"@rjsf/material-ui": 3.2.1
"@rjsf/utils": ^5.0.0-beta.12
"@rjsf/validator-ajv6": ^5.0.0-beta.12
"@types/d3-shape": ^1.2.6
"@xstate/react": ^1.0.0
axios: ^0.27.2
chart.js: 3.6.2
chartjs-plugin-datalabels: 2.0.0
classnames: ^2.3.1
copy-to-clipboard: ^3.0.8
cronstrue: ^1.31.0
d3-dag: ^0.3.4
d3-shape: ^1.2.2
dagre: 0.8.5
dagre-d3: ^0.6.4
debug: 2.6.9
dom-helpers: ^3.4.0
fuzzysort: ^1.1.1
intersection-observer: ^0.7.0
js-yaml: ^3.13.1
linkify-it: ^2.2.0
lodash: ^4.17.21
lossless-json: ^1.0.3
memoize-one: ^5.0.0
moment: ^2.29.4
moment-timezone: ^0.5.28
notistack: ^1.0.10
object-hash: ^1.3.1
prop-types: 15.6.0
query-string: ^6.5.0
react-chartjs-2: ^4.3.1
react-flow-renderer: 10.3.8
react-ga4: ^1.4.1
react-intersection-observer: ^8.25.1
react-json-view: ^1.21.3
react-loading-skeleton: ^1.1.2
react-query: 3.3.0
react-query-devtools: 3.0.0-beta.1
react-virtualized: ^9.21.1
shallowequal: ^1.1.0
url-search-params: ^0.10.0
xstate: 4.33.6
peerDependencies:
long: ^4.0.0
protobufjs: ~6.11.3
react: ^16.14.0
react-dom: ^16.14.0
react-router: ^5.3.4
react-router-dom: ^5.3.4
use-react-router: ^1.0.7
checksum: 998c925f806d61cd549687fb36d24c765f42daacd1892dea8c2fc1f334ce8e1d0146bf1687f7e1328a4df29fd620d78f5ecc17ca7e4547d595420c876e963fd8
languageName: node
linkType: hard

"@flyteorg/console@workspace:packages/console":
"@flyteorg/console@^0.0.10, @flyteorg/console@workspace:packages/console":
version: 0.0.0-use.local
resolution: "@flyteorg/console@workspace:packages/console"
dependencies:
Expand Down Expand Up @@ -3347,25 +3277,6 @@ __metadata:
languageName: node
linkType: hard

"@rjsf/core@npm:3.2.1":
version: 3.2.1
resolution: "@rjsf/core@npm:3.2.1"
dependencies:
"@types/json-schema": ^7.0.7
ajv: ^6.7.0
core-js-pure: ^3.6.5
json-schema-merge-allof: ^0.6.0
jsonpointer: ^5.0.0
lodash: ^4.17.15
nanoid: ^3.1.23
prop-types: ^15.7.2
react-is: ^16.9.0
peerDependencies:
react: ">=16"
checksum: 2142d4a31229ea242b79aca4ed93e2fe89e75f15ce93111457c3017d3ab295cae8f53e4dd870c619afa571959d00f46b3c19085c6a336f522c891fc07ecc46f1
languageName: node
linkType: hard

"@rjsf/core@npm:^5.1.0":
version: 5.1.0
resolution: "@rjsf/core@npm:5.1.0"
Expand All @@ -3381,18 +3292,6 @@ __metadata:
languageName: node
linkType: hard

"@rjsf/material-ui@npm:3.2.1":
version: 3.2.1
resolution: "@rjsf/material-ui@npm:3.2.1"
peerDependencies:
"@material-ui/core": ^4.2.0
"@material-ui/icons": ^4.2.1
"@rjsf/core": ^3.0.0
react: ">=16"
checksum: bd25cd9f2e2d568c653755e7268fe3e53279e1ae675e39bccd85f65557623d2052b706763e017a949f897751e25a16d0f2c8b995508bb56907be6786b09e2b1e
languageName: node
linkType: hard

"@rjsf/material-ui@npm:^5.1.0":
version: 5.1.0
resolution: "@rjsf/material-ui@npm:5.1.0"
Expand All @@ -3406,21 +3305,6 @@ __metadata:
languageName: node
linkType: hard

"@rjsf/utils@npm:^5.0.0-beta.12":
version: 5.0.0-beta.14
resolution: "@rjsf/utils@npm:5.0.0-beta.14"
dependencies:
json-schema-merge-allof: ^0.8.1
jsonpointer: ^5.0.1
lodash: ^4.17.15
lodash-es: ^4.17.15
react-is: ^18.2.0
peerDependencies:
react: ^16.14.0 || >=17
checksum: 66d29377c98f6e778ec0b167734a949528b0ca2bfb4776dea74fd70add1fb339e14ec878b9162a152e83804bc8094c3ebcd9ebf8b1b68a63c6ee2bf4548938c8
languageName: node
linkType: hard

"@rjsf/utils@npm:^5.1.0":
version: 5.1.0
resolution: "@rjsf/utils@npm:5.1.0"
Expand All @@ -3436,19 +3320,6 @@ __metadata:
languageName: node
linkType: hard

"@rjsf/validator-ajv6@npm:^5.0.0-beta.12":
version: 5.0.0-beta.14
resolution: "@rjsf/validator-ajv6@npm:5.0.0-beta.14"
dependencies:
ajv: ^6.7.0
lodash: ^4.17.15
lodash-es: ^4.17.15
peerDependencies:
"@rjsf/utils": ^5.0.0-beta.1
checksum: 57b5c6968475a66762f644f2832aad077f8dde0ca9e71c8b0b27c06174855b7e6330f44fa6078fc0f347b728a4a5fd62399378fad26ada3cde32da89bddf6f9f
languageName: node
linkType: hard

"@rjsf/validator-ajv8@npm:^5.1.0":
version: 5.1.0
resolution: "@rjsf/validator-ajv8@npm:5.1.0"
Expand Down Expand Up @@ -5333,7 +5204,7 @@ __metadata:
languageName: node
linkType: hard

"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.7, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9":
"@types/json-schema@npm:*, @types/json-schema@npm:^7.0.4, @types/json-schema@npm:^7.0.5, @types/json-schema@npm:^7.0.8, @types/json-schema@npm:^7.0.9":
version: 7.0.11
resolution: "@types/json-schema@npm:7.0.11"
checksum: 527bddfe62db9012fccd7627794bd4c71beb77601861055d87e3ee464f2217c85fca7a4b56ae677478367bbd248dbde13553312b7d4dbc702a2f2bbf60c4018d
Expand Down Expand Up @@ -6558,7 +6429,7 @@ __metadata:
languageName: node
linkType: hard

"ajv@npm:^6.1.0, ajv@npm:^6.10.0, ajv@npm:^6.10.2, ajv@npm:^6.12.2, ajv@npm:^6.12.4, ajv@npm:^6.12.5, ajv@npm:^6.7.0":
"ajv@npm:^6.1.0, ajv@npm:^6.10.0, ajv@npm:^6.10.2, ajv@npm:^6.12.2, ajv@npm:^6.12.4, ajv@npm:^6.12.5":
version: 6.12.6
resolution: "ajv@npm:6.12.6"
dependencies:
Expand Down Expand Up @@ -8714,7 +8585,7 @@ __metadata:
languageName: node
linkType: hard

"compute-lcm@npm:^1.1.0, compute-lcm@npm:^1.1.2":
"compute-lcm@npm:^1.1.2":
version: 1.1.2
resolution: "compute-lcm@npm:1.1.2"
dependencies:
Expand Down Expand Up @@ -8963,7 +8834,7 @@ __metadata:
languageName: node
linkType: hard

"core-js-pure@npm:^3.23.3, core-js-pure@npm:^3.25.1, core-js-pure@npm:^3.6.5":
"core-js-pure@npm:^3.23.3, core-js-pure@npm:^3.25.1":
version: 3.26.1
resolution: "core-js-pure@npm:3.26.1"
checksum: d88c40e5e29e413c11d1ef991a8d5b6a63f00bd94707af0f649d3fc18b3524108b202f4ae75ce77620a1557d1ba340bc3362b4f25d590eccc37cf80fc75f7cd4
Expand Down Expand Up @@ -14743,17 +14614,6 @@ __metadata:
languageName: node
linkType: hard

"json-schema-merge-allof@npm:^0.6.0":
version: 0.6.0
resolution: "json-schema-merge-allof@npm:0.6.0"
dependencies:
compute-lcm: ^1.1.0
json-schema-compare: ^0.2.2
lodash: ^4.17.4
checksum: 2008aede3f5d05d7870e7d5e554e5c6a5b451cfff1357d34d3d8b34e2ba57468a97c76aa5b967bdb411d91b98c734f19f350de578d25b2a0a27cd4e1ca92bd1d
languageName: node
linkType: hard

"json-schema-merge-allof@npm:^0.8.1":
version: 0.8.1
resolution: "json-schema-merge-allof@npm:0.8.1"
Expand Down Expand Up @@ -14840,7 +14700,7 @@ __metadata:
languageName: node
linkType: hard

"jsonpointer@npm:^5.0.0, jsonpointer@npm:^5.0.1":
"jsonpointer@npm:^5.0.1":
version: 5.0.1
resolution: "jsonpointer@npm:5.0.1"
checksum: 0b40f712900ad0c846681ea2db23b6684b9d5eedf55807b4708c656f5894b63507d0e28ae10aa1bddbea551241035afe62b6df0800fc94c2e2806a7f3adecd7c
Expand Down Expand Up @@ -16391,7 +16251,7 @@ __metadata:
languageName: node
linkType: hard

"nanoid@npm:^3.1.23, nanoid@npm:^3.3.1, nanoid@npm:^3.3.4":
"nanoid@npm:^3.3.1, nanoid@npm:^3.3.4":
version: 3.3.4
resolution: "nanoid@npm:3.3.4"
bin:
Expand Down Expand Up @@ -18704,7 +18564,7 @@ __metadata:
languageName: node
linkType: hard

"react-is@npm:^16.13.1, react-is@npm:^16.6.0, react-is@npm:^16.7.0, react-is@npm:^16.9.0":
"react-is@npm:^16.13.1, react-is@npm:^16.6.0, react-is@npm:^16.7.0":
version: 16.13.1
resolution: "react-is@npm:16.13.1"
checksum: f7a19ac3496de32ca9ae12aa030f00f14a3d45374f1ceca0af707c831b2a6098ef0d6bdae51bd437b0a306d7f01d4677fcc8de7c0d331eb47ad0f46130e53c5f
Expand Down

0 comments on commit 154e5ed

Please sign in to comment.