package.json中存在冲突的包引用,包括@angular/cli:1.7.0和“@angular devkit/build angular”:“~0.6.0”,我已经修复了这些引用。
我也更新了Docker文件
### STAGE 1: Build ###
# We label our stage as âbuilderâ
FROM node:10.0.0 as builder
#Cleanup
RUN npm cache clean
#RUN rmdir node_modules /s /q
RUN npm install -g typescript@2.7.2
COPY package.json ./
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build.
RUN npm i && mkdir /ng-app && cp -R ./node_modules ./ng-app
WORKDIR /ng-app
COPY . .
## Checking node version and that it can be accessed irectly
RUN node
## ng Version check
RUN $(npm bin)/ng
##RUN npm rebuild node-sass
## Build the angular app in production mode and store t he artifacts in dist folder
##RUN node
##RUN REM call npm install -g @angular/cli
RUN $(npm bin)/ng build
### STAGE 2: Setup ###
# base image
FROM nginx:1.13.9-alpine
# copy artifact build from the 'build environment'
COPY
# expose port 80
EXPOSE 80
# run nginx
CMD ["nginx", "-g", "daemon off;"]
我最终创建了一个基本的docker映像,并一次运行dockerfile中定义的步骤,以通过ssh将根本原因隔离到容器中。