Итак, я пытаюсь Dockerize моего Angular универсального приложения, чтобы использовать его с уже докеризованным бэкэндом с пружинной загрузкой, и я испытываю затруднения, чтобы получить некоторую помощь и ресурсы для inte rnet. Здесь у меня есть пример Dockerfile Angular универсальный, но он не работает для меня, несмотря на изменения, которые я делаю.
FROM node:12-alpine as buildContainer
WORKDIR /app
COPY ./package.json ./package-lock.json /app/
RUN npm install
COPY . /app
RUN npm run build:universal
# RUN npm run generate:pretender
RUN npm run test:ssr
FROM node:8-alpine
WORKDIR /app
# Copy dependency definitions
COPY --from=buildContainer /app/package.json /app
# COPY --from=buildContainer /app/server.js /app
# Get all the code needed to run the app
COPY --from=buildContainer /app/dist /app/dist
# COPY --from=buildContainer /app/static /app/static
COPY --from=buildContainer /app/dist-server /app/dist-server
# Expose the port the app runs in
EXPOSE 4200
# Serve the app
CMD ["npm", "run", "server"]
Я строю образ с помощью следующей команды docker build -t angular-universal .
, но он не работает на 6-м шаге говорят
npm ОШИБКА! отсутствует скрипт: build: universal npm ERR! Полный журнал этого прогона можно найти в: npm ERR! /root/.npm/_logs/2020-04-19T20_29_16_368Z-debug.log Команда '/ bin / sh - c npm run build: universal' вернула ненулевой код: 1
У кого-нибудь была такая же проблема?
Вот мой пакет. json
{
"name": "jobnow",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"deploy": "ng deploy --base-href=https://samgevorgyan.github.io/jobnow/"
},
"private": true,
"dependencies": {
"@angular/animations": "~9.0.1",
"@angular/cdk": "^9.0.0",
"@angular/common": "~9.0.1",
"@angular/compiler": "~9.0.1",
"@angular/core": "~9.0.1",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "~9.0.1",
"@angular/material": "^9.0.0",
"@angular/material-moment-adapter": "^9.1.2",
"@angular/platform-browser": "~9.0.1",
"@angular/platform-browser-dynamic": "~9.0.1",
"@angular/router": "~9.0.1",
"@capacitor/android": "^1.5.0",
"@capacitor/angular": "^1.0.2",
"@capacitor/core": "latest",
"@fortawesome/angular-fontawesome": "^0.6.1",
"@fortawesome/fontawesome-svg-core": "^1.2.28",
"@fortawesome/free-brands-svg-icons": "^5.13.0",
"@fortawesome/free-regular-svg-icons": "^5.13.0",
"@fortawesome/free-solid-svg-icons": "^5.13.0",
"@gilsdav/ngx-translate-router": "^3.0.0",
"@gilsdav/ngx-translate-router-http-loader": "^1.1.0",
"@ngrx/effects": "^8.6.0",
"@ngrx/store": "^8.6.0",
"@ngrx/store-devtools": "^8.6.0",
"@ngx-translate/core": "^12.1.2",
"@ngx-translate/http-loader": "^4.0.0",
"@types/googlemaps": "^3.39.3",
"angular-cli-ghpages": "^0.6.2",
"crypto-ts": "^1.0.2",
"moment": "^2.24.0",
"ngx-cookie-service": "^3.0.3",
"ngx-image-cropper": "^3.1.6",
"ngx-toastr": "^12.0.0",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.901.0",
"@angular/cli": "^9.1.0",
"@angular/compiler-cli": "~9.0.1",
"@angular/language-service": "~9.0.1",
"@capacitor/cli": "latest",
"@types/jasmine": "~3.5.4",
"@types/jasminewd2": "~2.0.8",
"@types/node": "~13.7.1",
"codelyzer": "^5.2.1",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^5.0.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.1",
"karma-jasmine": "~3.1.1",
"karma-jasmine-html-reporter": "^1.5.2",
"protractor": "~5.4.3",
"ts-node": "~8.6.2",
"tslint": "^6.1.1",
"typescript": "^3.7.5"
}
}