出现Docker错误,仅与Vue脚本不退出相关。

huangapple go评论111阅读模式
英文:

Getting an error with docker only with vue script not exiting

问题

以下是您提供的内容的中文翻译:

遇到一个问题,构建不会退出,而是卡住了,似乎是一个 Docker 问题,不知道是构建脚本还是 Docker 配置的问题。

错误如下。

08:50:26 dist/js/chunk-vendors.5fdcf219.js 1535.30 KiB 407.76 KiB
08:50:26 dist/js/chunk-fd02e1a8.e5248c2e.js 320.44 KiB 31.10 KiB
08:50:26 dist/js/app.5c1491df.js 56.47 KiB 14.33 KiB
08:50:26 dist/js/chunk-4650e401.6a578735.js 16.14 KiB 4.33 KiB
08:50:26 dist/css/chunk-vendors.fef290ac.css 677.70 KiB 85.83 KiB
08:50:26 dist/css/chunk-4650e401.e054842e.css 224.21 KiB 28.29 KiB
08:50:26 dist/css/app.7ac31790.css 192.56 KiB 28.69 KiB
08:50:26 dist/css/chunk-fd02e1a8.280e1f3c.css 9.79 KiB 1.89 KiB
08:50:26
08:50:26 图像和其他类型的资源被省略。
08:50:26
08:50:26 完成 构建完成。dist 目录已准备好部署。
08:50:26 信息 请查看部署说明:https://cli.vuejs.org/guide/deployment.html

以下是 Docker 脚本。

FROM node16.10-alpine3.11 as build-stage

USER root
WORKDIR /app
COPY app/ ./
RUN chown -R root:root /app
RUN npm install --verbose

在这里失败

RUN npm run build --verbose
RUN npm prune --production

FROM nginx:1.19.10 as production-stage
COPY --from=build-stage --chown=1000:1000 /app/dist /usr/share/nginx/html
COPY --chown=1000:1000 ./nginx-config/nginx.conf /etc/nginx/nginx.conf
COPY --chown=1000:1000 ./nginx-config/default.conf /etc/nginx/conf.d/default.conf
COPY --chown=1000:1000 ./config/* /usr/share/nginx/html/
COPY --chown=1000:1000 entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["run.sh"]

...

旧项目的 package.json 如下:

{
"name": "myapp",
"version": "0.1.3",
"private": true,
"scripts": {
"serve": "./serve.sh",
"build": "vue-cli-service build && npm run test:unit",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit --no-cache"
},
"dependencies": {
"@vue/eslint-config-airbnb": "^4.0.1",
"axios": "0.18.0",
"babel-polyfill": "6.26.0",
"core-util-is": "^1.0.2",
"lodash": "^4.17.15",
"moment": "2.29.4",
"vue": "2.5.19",
"vue-cookies": "^1.8.2",
"vue-i18n": "8.28.0",
"vue-router": "3.6.5",
"vue-template-compiler": "2.5.19",
"vuelidate": "0.7.4",
"vuetify": "1.2.1",
"vuex": "3.0.1"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/polyfill": "^7.0.0-beta.49",
"@babel/preset-env": "^7.3.1",
"@kazupon/vue-i18n-loader": "^0.3.0",
"@vue/cli-plugin-babel": "^3.10.0",
"@vue/cli-plugin-eslint": "^3.10.0",
"@vue/cli-plugin-unit-jest": "^3.10.0",
"@vue/cli-service": "^3.10.0",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"html-loader": "^0.5.5",
"jest-raw-loader": "^1.0.1",
"lint-staged": "^7.2.2",
"raw-loader": "^3.1.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"vue-cli-plugin-i18n": "^0.5.0",
"vue-cli-plugin-vuetify": "^0.1.6",
"vue-loader": "^15.4.2",
"handlebars": "4.5.0"
},
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"src/**/.js": [
"vue-cli-service lint",
"git add"
],
"
.vue": [
"vue-cli-service lint",
"git add"
]
}
}

英文:

Getting ann issue where the build doesn't exit and just hangs, seems to be a docker issue, don't know if issue with build script or docker configuration.

Error is below.

  1. 08:50:26 dist/js/chunk-vendors.5fdcf219.js 1535.30 KiB 407.76 KiB
  2. 08:50:26 dist/js/chunk-fd02e1a8.e5248c2e.js 320.44 KiB 31.10 KiB
  3. 08:50:26 dist/js/app.5c1491df.js 56.47 KiB 14.33 KiB
  4. 08:50:26 dist/js/chunk-4650e401.6a578735.js 16.14 KiB 4.33 KiB
  5. 08:50:26 dist/css/chunk-vendors.fef290ac.css 677.70 KiB 85.83 KiB
  6. 08:50:26 dist/css/chunk-4650e401.e054842e.css 224.21 KiB 28.29 KiB
  7. 08:50:26 dist/css/app.7ac31790.css 192.56 KiB 28.69 KiB
  8. 08:50:26 dist/css/chunk-fd02e1a8.280e1f3c.css 9.79 KiB 1.89 KiB
  9. 08:50:26
  10. 08:50:26 Images and other types of assets omitted.
  11. 08:50:26
  12. 08:50:26 DONE Build complete. The dist directory is ready to be deployed.
  13. 08:50:26 INFO Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

Here is the docker script.

  1. FROM node16.10-alpine3.11 as build-stage
  2. USER root
  3. WORKDIR /app
  4. COPY app/ ./
  5. RUN chown -R root:root /app
  6. RUN npm install --verbose
  7. # fails here
  8. RUN npm run build --verbose
  9. RUN npm prune --production
  10. FROM nginx:1.19.10 as production-stage
  11. COPY --from=build-stage --chown=1000:1000 /app/dist /usr/share/nginx/html
  12. COPY --chown=1000:1000 ./nginx-config/nginx.conf /etc/nginx/nginx.conf
  13. COPY --chown=1000:1000 ./nginx-config/default.conf /etc/nginx/conf.d/default.conf
  14. COPY --chown=1000:1000 ./config/* /usr/share/nginx/html/
  15. COPY --chown=1000:1000 entrypoint.sh /usr/local/bin/docker-entrypoint.sh
  16. ENTRYPOINT ["run.sh"]

...

and older project, package.json

  1. {
  2. "name": "myapp",
  3. "version": "0.1.3",
  4. "private": true,
  5. "scripts": {
  6. "serve": "./serve.sh",
  7. "build": "vue-cli-service build && npm run test:unit",
  8. "lint": "vue-cli-service lint",
  9. "test:unit": "vue-cli-service test:unit --no-cache"
  10. },
  11. "dependencies": {
  12. "@vue/eslint-config-airbnb": "^4.0.1",
  13. "axios": "0.18.0",
  14. "babel-polyfill": "6.26.0",
  15. "core-util-is": "^1.0.2",
  16. "lodash": "^4.17.15",
  17. "moment": "2.29.4",
  18. "vue": "2.5.19",
  19. "vue-cookies": "^1.8.2",
  20. "vue-i18n": "8.28.0",
  21. "vue-router": "3.6.5",
  22. "vue-template-compiler": "2.5.19",
  23. "vuelidate": "0.7.4",
  24. "vuetify": "1.2.1",
  25. "vuex": "3.0.1"
  26. },
  27. "devDependencies": {
  28. "@babel/plugin-proposal-optional-chaining": "^7.2.0",
  29. "@babel/polyfill": "^7.0.0-beta.49",
  30. "@babel/preset-env": "^7.3.1",
  31. "@kazupon/vue-i18n-loader": "^0.3.0",
  32. "@vue/cli-plugin-babel": "^3.10.0",
  33. "@vue/cli-plugin-eslint": "^3.10.0",
  34. "@vue/cli-plugin-unit-jest": "^3.10.0",
  35. "@vue/cli-service": "^3.10.0",
  36. "@vue/test-utils": "^1.0.0-beta.29",
  37. "babel-core": "^7.0.0-bridge.0",
  38. "babel-jest": "^23.0.1",
  39. "html-loader": "^0.5.5",
  40. "jest-raw-loader": "^1.0.1",
  41. "lint-staged": "^7.2.2",
  42. "raw-loader": "^3.1.0",
  43. "stylus": "^0.54.5",
  44. "stylus-loader": "^3.0.2",
  45. "vue-cli-plugin-i18n": "^0.5.0",
  46. "vue-cli-plugin-vuetify": "^0.1.6",
  47. "vue-loader": "^15.4.2",
  48. "handlebars": "4.5.0"
  49. },
  50. "gitHooks": {
  51. "pre-commit": "lint-staged"
  52. },
  53. "lint-staged": {
  54. "src/**/*.js": [
  55. "vue-cli-service lint",
  56. "git add"
  57. ],
  58. "*.vue": [
  59. "vue-cli-service lint",
  60. "git add"
  61. ]
  62. }
  63. }

答案1

得分: 1

以下模块中的某些内容解决了问题,必须与导致 vue 编译器挂起的问题有关。

{
"name": "app",
"version": "1.1.5",
"private": true,
"scripts": {
"serve": "./serve.sh",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit --no-cache"
},
"dependencies": {
"@vue/eslint-config-airbnb": "^4.0.1",
"axios": "0.21.2",
"babel-polyfill": "6.26.0",
"core-util-is": "^1.0.2",
"lodash": "^4.17.15",
"moment": "2.29.2",
"vue": "2.6.11",
"vue-cookies": "^1.5.13",
"vue-i18n": "8.15.1",
"vue-router": "3.1.3",
"vue-template-compiler": "2.5.22",
"vuelidate": "0.7.4",
"vuetify": "1.2.1",
"vuex": "3.0.1"
},
"devDependencies": {
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
"@babel/polyfill": "^7.7.0",
"@babel/preset-env": "^7.7.7",
"@kazupon/vue-i18n-loader": "^0.3.0",
"@vue/cli-plugin-babel": "^4.2.0",
"@vue/cli-plugin-eslint": "^4.2.0",
"@vue/cli-plugin-unit-jest": "^4.2.0",
"@vue/cli-service": "^4.2.0",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^8.2.6",
"babel-jest": "^23.0.1",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.1.2",
"html-loader": "^0.5.5",
"jest-raw-loader": "^1.0.1",
"lint-staged": "^7.3.0",
"raw-loader": "^3.1.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.2",
"vue-cli-plugin-i18n": "^0.6.1",
"vue-cli-plugin-vuetify": "^0.6.3",
"vue-loader": "^15.8.3",
"vue-template-compiler": "2.6.11",
"handlebars": "4.5.0"
}
}

英文:

Something in the following modules resolved the issue, it must have been around the vue compiler that was hanging up.

  1. {
  2. "name": "app",
  3. "version": "1.1.5",
  4. "private": true,
  5. "scripts": {
  6. "serve": "./serve.sh",
  7. "build": "vue-cli-service build",
  8. "lint": "vue-cli-service lint",
  9. "test:unit": "vue-cli-service test:unit --no-cache"
  10. },
  11. "dependencies": {
  12. "@vue/eslint-config-airbnb": "^4.0.1",
  13. "axios": "0.21.2",
  14. "babel-polyfill": "6.26.0",
  15. "core-util-is": "^1.0.2",
  16. "lodash": "^4.17.15",
  17. "moment": "2.29.2",
  18. "vue": "2.6.11",
  19. "vue-cookies": "^1.5.13",
  20. "vue-i18n": "8.15.1",
  21. "vue-router": "3.1.3",
  22. "vue-template-compiler": "2.5.22",
  23. "vuelidate": "0.7.4",
  24. "vuetify": "1.2.1",
  25. "vuex": "3.0.1"
  26. },
  27. "devDependencies": {
  28. "@babel/plugin-proposal-optional-chaining": "^7.7.5",
  29. "@babel/polyfill": "^7.7.0",
  30. "@babel/preset-env": "^7.7.7",
  31. "@kazupon/vue-i18n-loader": "^0.3.0",
  32. "@vue/cli-plugin-babel": "^4.2.0",
  33. "@vue/cli-plugin-eslint": "^4.2.0",
  34. "@vue/cli-plugin-unit-jest": "^4.2.0",
  35. "@vue/cli-service": "^4.2.0",
  36. "@vue/test-utils": "^1.0.0-beta.29",
  37. "babel-core": "^7.0.0-bridge.0",
  38. "babel-eslint": "^8.2.6",
  39. "babel-jest": "^23.0.1",
  40. "eslint": "^6.7.2",
  41. "eslint-plugin-vue": "^6.1.2",
  42. "html-loader": "^0.5.5",
  43. "jest-raw-loader": "^1.0.1",
  44. "lint-staged": "^7.3.0",
  45. "raw-loader": "^3.1.0",
  46. "stylus": "^0.54.5",
  47. "stylus-loader": "^3.0.2",
  48. "vue-cli-plugin-i18n": "^0.6.1",
  49. "vue-cli-plugin-vuetify": "^0.6.3",
  50. "vue-loader": "^15.8.3",
  51. "vue-template-compiler": "2.6.11",
  52. "handlebars": "4.5.0"
  53. }
  54. }

huangapple
  • 本文由 发表于 2023年5月20日 20:56:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76295345.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定