使用NPM为Angular构建Docker映像

时间:2018-12-14 22:24:33

标签: angular docker

嗨,我正在尝试为我的角度应用程序构建docker映像,这是我的docker文件

#FROM nodejs/base:latest


#Input Parameters
ARG version

#Set environment variables
ENV HOST localhost
ENV PORT 8080
ENV SERVICE_NAME App-Web




WORKDIR /App-Web
COPY package.json ./
RUN npm config set registry http://registry.npmjs.org/
RUN npm install
COPY . .

ADD src/ /App-Web/
EXPOSE $PORT

#Run mimeo ui
#CMD [ "npm", "start" ]
CMD bash -c "cd /App-Web/ && \
ls -lt && \
npm start && \
tail -f app.log

这是我的angular-cli

"scripts": ["../node_modules/chart.js/dist/Chart.js"],
            "environmentSource": "environments/environment.ts",
            "environments": {
                "dev": "environments/environment.ts",
                "prod": "environments/environment.prod.ts"

package.json是这个

{
    "name": "App-ui",
    "version": "4.0.0",
    "license": "Apache",
    "scripts": {
        "ng": "ng",
        "start": "ng serve --proxy-config proxy.conf.js --host 0.0.0.0 -p 8080 --disable-host-check >> app.log 2>&1 &",
        "buildProd": "ng build --prod",
        "buildDev": "ng build",
        "gitbuild": "ng build --prod --base /argus_ui/master/dist/",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
    },

我在package.json中定义了2个属性

“ buildProd”:“ ng build --prod”,         “ buildDev”:“ ng build --dev”,

当我尝试执行npm run buildDev时,它仍然具有prod属性

0 个答案:

没有答案