我正试图通过比特桶管道在服务器上部署我的angular通用应用程序。我在bitbucket-pipelines.yml
中编写了如下脚本:
pipelines:
default:
- step:
name: Build app
caches:
- node
script:
- npm install
- npm install -g @angular/cli
- npm run build:ssr
- npm run serve:ssr
artifacts:
- dist/**
我的package.json
有以下脚本:
"scripts": {
"ng": "ng",
"start": "ng serve -c=dev -o",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"serve:ssr": "node dist/server.js",
"build:client-and-server-bundles": "ng build --prod && ng run my-app:server",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors"
},
当npm run serve:ssr
执行时,我看到它给出的输出与本地主机上的输出相同,即Node server listening on http://localhost:4000
。它在这一点上卡住了。我在这里做错了什么?
我认为您需要添加一个远程服务器,您可以在下面看到一个.yml文件的示例
image: node:10
pipelines:
branches:
master:
- step:
name: Installation
caches:
- node
script:
- npm install
artifacts:
- node_modules/** # Save modules for next steps
- step:
name: Lint
script:
- npm run lint
- step:
name: Build
script:
- npm run build:production
artifacts:
- dist/** # Save build for next steps
- step:
name: Deploy
script:
- echo "$(ls -la)"
- echo "$(ls -la dist)"
- ssh user@your-server rm -rf /var/www/www.your-domain.net/html/your-app
- scp -r dist/your-app user@your-server:/var/www/your-domain.at/html/your-app