Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update 优化 Dockerfile layer #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

eamonzzz
Copy link

  1. 优化 Dockerfile layer
  2. 更新 node 版本
  3. 减少安装包和镜像大小

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在构建 1.12.0 已经不行,会报以下的报错
yarn run v1.22.19 $ NODE_ENV=production ykit pack -m (node:134) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency (Use node --trace-warnings ...` to show where the warning was created)
(node:134) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
[error] .//recharts/lib/polyfill.js
Module not found: Error: Cannot resolve module 'core-js/es/math' in /yapi/vendors/node_modules/recharts/lib
@ ./
/recharts/lib/polyfill.js 3:0-26

[error] .//recharts/lib/polyfill.js
Module not found: Error: Cannot resolve module 'core-js/es/number' in /yapi/vendors/node_modules/recharts/lib
@ ./
/recharts/lib/polyfill.js 5:0-28

[error] ../config.json
Module build failed: SyntaxError: Unexpected token m in JSON at position 0
at JSON.parse ()
at Object.module.exports (/yapi/vendors/node_modules/json-loader/index.js:4:49)
@ ./server/yapi.js 12:13-41

[error] .//fs-extra/lib/empty/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/fs-extra/lib/empty
@ ./
/fs-extra/lib/empty/index.js 4:11-24

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 13:12-26

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'dns' in /yapi/vendors/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 14:12-26

[error] .//nodemailer/lib/shared/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/shared
@ ./
/nodemailer/lib/shared/index.js 5:11-24

[error] .//nodemailer/lib/sendmail-transport/index.js
Module not found: Error: Cannot resolve module 'child_process' in /yapi/vendors/node_modules/nodemailer/lib/sendmail-transport
@ ./
/nodemailer/lib/sendmail-transport/index.js 3:14-38

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 7:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 5:12-26

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'tls' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 8:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'tls' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 6:12-26

[error] .//nodemailer/lib/dkim/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/dkim
@ ./
/nodemailer/lib/dkim/index.js 10:11-24

[error] .//graceful-fs/graceful-fs.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/graceful-fs
@ ./
/graceful-fs/graceful-fs.js 1:9-22

[error] .//nodemailer/lib/mime-node/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/mime-node
@ ./
/nodemailer/lib/mime-node/index.js 7:11-24

[error] .//jsonfile/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/jsonfile
@ ./
/jsonfile/index.js 5:8-21

[error] [email protected] from UglifyJs
SyntaxError: Unexpected token: operator (>) [../~/fs-extra/lib/util/assign.js:5,0]

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn && node /yapi/scripts/clean.js $(pwd) && yarn build-client && node /yapi/scripts/clean.js $(pwd) && rm -rf /yapi/scripts' returned a non-zero code: 1`

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

现在构建 1.12.0 已经不行,会报以下的报错
yarn run v1.22.19 $ NODE_ENV=production ykit pack -m (node:134) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency (Use node --trace-warnings ...` to show where the warning was created)
(node:134) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:134) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
[error] .//recharts/lib/polyfill.js
Module not found: Error: Cannot resolve module 'core-js/es/math' in /yapi/vendors/node_modules/recharts/lib
@ ./
/recharts/lib/polyfill.js 3:0-26

[error] .//recharts/lib/polyfill.js
Module not found: Error: Cannot resolve module 'core-js/es/number' in /yapi/vendors/node_modules/recharts/lib
@ ./
/recharts/lib/polyfill.js 5:0-28

[error] ../config.json
Module build failed: SyntaxError: Unexpected token m in JSON at position 0
at JSON.parse ()
at Object.module.exports (/yapi/vendors/node_modules/json-loader/index.js:4:49)
@ ./server/yapi.js 12:13-41

[error] .//fs-extra/lib/empty/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/fs-extra/lib/empty
@ ./
/fs-extra/lib/empty/index.js 4:11-24

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 13:12-26

[error] .//nodemailer/lib/mailer/index.js
Module not found: Error: Cannot resolve module 'dns' in /yapi/vendors/node_modules/nodemailer/lib/mailer
@ ./
/nodemailer/lib/mailer/index.js 14:12-26

[error] .//nodemailer/lib/shared/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/shared
@ ./
/nodemailer/lib/shared/index.js 5:11-24

[error] .//nodemailer/lib/sendmail-transport/index.js
Module not found: Error: Cannot resolve module 'child_process' in /yapi/vendors/node_modules/nodemailer/lib/sendmail-transport
@ ./
/nodemailer/lib/sendmail-transport/index.js 3:14-38

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 7:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'net' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 5:12-26

[error] .//nodemailer/lib/smtp-connection/http-proxy-client.js
Module not found: Error: Cannot resolve module 'tls' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/http-proxy-client.js 8:12-26

[error] .//nodemailer/lib/smtp-connection/index.js
Module not found: Error: Cannot resolve module 'tls' in /yapi/vendors/node_modules/nodemailer/lib/smtp-connection
@ ./
/nodemailer/lib/smtp-connection/index.js 6:12-26

[error] .//nodemailer/lib/dkim/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/dkim
@ ./
/nodemailer/lib/dkim/index.js 10:11-24

[error] .//graceful-fs/graceful-fs.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/graceful-fs
@ ./
/graceful-fs/graceful-fs.js 1:9-22

[error] .//nodemailer/lib/mime-node/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/nodemailer/lib/mime-node
@ ./
/nodemailer/lib/mime-node/index.js 7:11-24

[error] .//jsonfile/index.js
Module not found: Error: Cannot resolve module 'fs' in /yapi/vendors/node_modules/jsonfile
@ ./
/jsonfile/index.js 5:8-21

[error] [email protected] from UglifyJs
SyntaxError: Unexpected token: operator (>) [../~/fs-extra/lib/util/assign.js:5,0]

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command '/bin/sh -c yarn && node /yapi/scripts/clean.js $(pwd) && yarn build-client && node /yapi/scripts/clean.js $(pwd) && rm -rf /yapi/scripts' returned a non-zero code: 1`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants