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

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

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.

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    Images and other types of assets omitted.
08:50:26  
08:50:26   DONE  Build complete. The dist directory is ready to be deployed.
08:50:26   INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

Here is the docker script.

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

USER root
WORKDIR /app
COPY app/ ./
RUN chown -R root:root /app
RUN npm install --verbose
# fails here
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"]

...

and older project, 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"
    ]
  }
}

答案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.

{
  "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"
  }
}

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:

确定