Запаковать Vue приложение в Docker образ

Цена договорная
13 мая 2020, 14:47 • 10 откликов • 56 просмотров
Необходимо запаковать Vue-приложение в Docker-образ,
чтобы он работал в режиме `npm run serve`,
пример Dockerfile:

FROM node:10.17.0
WORKDIR /usr/src/app
COPY package.json ./
COPY gulpfile.js ./
COPY src/project/frontend/ src/project/frontend/

RUN npm install

ENTRYPOINT ["npm", "run", "serve"] Сейчас он выкидывает ошибки что не может найти разные пакеты из devDependencies. Глобальная установка пакетов не всегда помогает.

package.json:

{
"name": "project",
"version": "1.0.0",
"description": "project desc,
"main": "gulpfile.js",
"dependencies": {
"bootstrap": "^3.4.1",
"core-js": "^3.6.4",
"gulp": "^3.9.1",
"gulp-clean-css": "^4.0.0",
"gulp-concat": "^2.6.1",
"gulp-debug": "^3.2.0",
"gulp-less": "^4.0.1",
"gulp-uglify": "^3.0.1",
"gulp-util": "^3.0.8",
"jquery": "^3.4.1",
"jquery-ui": "^1.12.1",
"less-plugin-autoprefix": "^2.0.0",
"merge-stream": "^1.0.1",
"moment": "^2.24.0",
"moment-range": "^4.0.2",
"npm": "^6.7.0",
"vue": "^2.6.11",
"vue-meta": "^2.3.3",
"vue-router": "^3.1.6",
"vue-toasted": "^1.1.28",
"vuex": "^3.1.3",
"whatwg-fetch": "^3.0.0",
"yargs": "^12.0.5"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@vue/cli-plugin-babel": "~4.3.0",
"@vue/cli-plugin-eslint": "~4.3.0",
"@vue/cli-plugin-router": "~4.3.0",
"@vue/cli-plugin-vuex": "~4.3.0",
"@vue/cli-service": "~4.3.0",
"@vue/eslint-config-airbnb": "^5.0.2",
"babel-eslint": "^10.0.3",
"browser-sync": "^2.23.2",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-vue": "^6.1.2",
"gulp-babel": "^8.0.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-terser": "^1.2.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
},
"scripts": {
"serve": "npm run serveGulp & npm run serveFrontend",
"serveFrontend": "cd ./src/project/frontend/ && vue-cli-service build --target lib main.js --watch --inline-vue --name frontend --mode development",
"serveGulp": "node ./node_modules/gulp/bin/gulp.js",
"build": "npm run buildFrontend && node ./node_modules/gulp/bin/gulp.js build",
"buildFrontend": "cd ./src/project/frontend/ && vue-cli-service build --target lib --inline-vue main.js --name frontend"
},
...
}